Current location: Hot Scripts Forums » General Web Coding » JavaScript » won't work in IE, but does in FF


won't work in IE, but does in FF

Reply
  #1 (permalink)  
Old 12-18-04, 09:00 PM
j_holmes j_holmes is offline
Newbie Coder
 
Join Date: Dec 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
won't work in IE, but does in FF

Hi all,

I've searched far and wide for a script that allows users to my site only if they came from a certain page (my login page). Well, I found it. The problem is that for some strange reason it stopped working with IE, but still works with Mozilla Firefox. No matter what I do, I keep getting the flag message in IE (must login first). I'm posting the actual script right from the page, so please if any sees why it is not allowing people with IE browsers, let me know.

I appreciate your time.

Thank You.

Here's the code:


<script>
function IsValidReferral()
{
from=document.referrer
domainname=from.substring(from.indexOf("//")+2,from.length)
domainname=domainname.substring(0,domainname.index Of("/"))
var referal_list=new Array("home.cogeco.ca","xyzabctemp.com","xyzabctem p1.com","xyzabctemp2.com");

flag=false;
for(i=0;i<referal_list.length;i++)
{
if(domainname==referal_list[i])
{flag=true
break;
}
}

if(!flag)
{alert("You Have To Login First To The Members Area "+from)
//It's not a referral site,Move to your login Page
location.href="http://home.cogeco.ca/~grimreaper/"
}

}
IsValidReferral();
</script>





Again, Thank You...
Reply With Quote
  #2 (permalink)  
Old 12-20-04, 10:08 AM
TwoD TwoD is offline
Community VIP
 
Join Date: Sep 2003
Location: 404
Posts: 1,813
Thanks: 0
Thanked 0 Times in 0 Posts
I tested the script in Frontpage (which should treat it the same as IE does) and it worked fine except for that the page wasn't loaded correctly. This is normal in Frontpage but try replacing location.href with document.location.href or just document.location

Btw, wrap code you are posting in the forum inside [code ] [/code ] wrappers. It keeps the forum from messing with it.
Reply With Quote
  #3 (permalink)  
Old 12-20-04, 11:07 AM
j_holmes j_holmes is offline
Newbie Coder
 
Join Date: Dec 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Hi TwoD,
thanks for the reply.

I don't think i explained myself right.

My problem lies when i try to login with my passw, and usern.
Although it is the referral page, it does not let me in like it once did.

Sorry for the mis-hap.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
The Art Nexus seeking PHP programmers TheArtNexus Job Offers & Assistance 5 02-26-08 03:08 AM
Seeking Work Wraith Job Offers & Assistance 4 11-01-04 08:28 AM
Grafix Work Submitting in PHP ports1980 PHP 1 08-09-04 11:31 AM
Programer available for work eTech James Job Offers & Assistance 0 08-02-04 01:47 PM
Web Designer/Programmer - Looking for work Lost Job Offers & Assistance 7 06-01-04 10:06 PM


All times are GMT -5. The time now is 10:37 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.