"Must visit from" javascript wont work in IE...

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved

Join Date: Feb 2005
Posts: 92
Reputation: NuGG is an unknown quantity at this point 
Solved Threads: 1
NuGG's Avatar
NuGG NuGG is offline Offline
Junior Poster in Training

"Must visit from" javascript wont work in IE...

 
0
  #1
Nov 24th, 2005
I have obtained the following script which only lets a page load if the visitor has been to the previous page, if they haven’t it sends the visitor to the appropriate page. However, it only works in Mozilla. Can anyone help me adapt this script to work in Internet Explorer?

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <SCRIPT LANGUAGE="JavaScript" >
  2. <!-- Begin
  3. var requiredfrom = "http://domain.com/somepage.htm"; // required prev. page
  4. if (document.referrer.indexOf(requiredfrom) == -1) {
  5. alert("You must logon first...");
  6. window.location=requiredfrom;
  7. }
  8. // End -->
  9. </script>
Cheers,
NuGG
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 92
Reputation: NuGG is an unknown quantity at this point 
Solved Threads: 1
NuGG's Avatar
NuGG NuGG is offline Offline
Junior Poster in Training

Re: "Must visit from" javascript wont work in IE...

 
0
  #2
Nov 24th, 2005
If you need an example of this script in action click here.

P.S. When I try this script in IE I receve the "must logon first" error regardless of visiting the previous page or not.
Last edited by NuGG; Nov 24th, 2005 at 8:27 am. Reason: incorrect hyperlink
Reply With Quote Quick reply to this message  
Join Date: Feb 2002
Posts: 12,036
Reputation: cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light 
Solved Threads: 128
Administrator
Staff Writer
cscgal's Avatar
cscgal cscgal is offline Offline
The Queen of DaniWeb

Re: "Must visit from" javascript wont work in IE...

 
0
  #3
Nov 24th, 2005
I'm using Internet Explorer and it worked for me!
Dani the Computer Science Gal
Follow my Twitter feed! twitter.com/daniweb
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 92
Reputation: NuGG is an unknown quantity at this point 
Solved Threads: 1
NuGG's Avatar
NuGG NuGG is offline Offline
Junior Poster in Training

Re: "Must visit from" javascript wont work in IE...

 
0
  #4
Nov 24th, 2005
How odd. What version of IE are you using? I've tried it on multiple computers with IE 6.0 and it didnt work on any of them...
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 92
Reputation: NuGG is an unknown quantity at this point 
Solved Threads: 1
NuGG's Avatar
NuGG NuGG is offline Offline
Junior Poster in Training

Re: "Must visit from" javascript wont work in IE...

 
0
  #5
Nov 25th, 2005
Does this javascript work in IE for anyone else?

Originally Posted by cscgal
I'm using Internet Explorer and it worked for me!

Its quite odd that it didnt work for me in IE but it works for you. Could it be something to do with the history settings in IE, or would that not make any difference?

The script works perfectly every time in firefox so i dont understand why it shouldnt work in IE.
Reply With Quote Quick reply to this message  
Join Date: Aug 2004
Posts: 49
Reputation: felgall is an unknown quantity at this point 
Solved Threads: 1
felgall felgall is offline Offline
Light Poster

Re: "Must visit from" javascript wont work in IE...

 
0
  #6
Nov 26th, 2005
document.referrer may contain the address of the previous page or it may not. There are a number of factors that can affect this such as browser settings, firewall settings, IE also suppresses the value if the prior page was on a secure server, etc. If this happens then you have no way to tell what page your visotir was on previous to coming to your page.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 1,655
Reputation: tgreer is an unknown quantity at this point 
Solved Threads: 35
Team Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: "Must visit from" javascript wont work in IE...

 
0
  #7
Nov 26th, 2005
...but it did work for me, IE and FireFox.
Reply With Quote Quick reply to this message  
Join Date: Oct 2005
Posts: 31
Reputation: Bomba is an unknown quantity at this point 
Solved Threads: 1
Bomba's Avatar
Bomba Bomba is offline Offline
Light Poster

Re: "Must visit from" javascript wont work in IE...

 
0
  #8
Nov 27th, 2005
You have successfully logged on...
Click here to continue.

Note: I take no responsibility for your presence on this site during school. You are here out of your own free will, and if you get your internet and email restricted its your own fault.
Then when I clicked the word "here" I got the you must log on message in a popup.
The stupidest person in the history of the world. That's me.
Reply With Quote Quick reply to this message  
Join Date: Aug 2004
Posts: 49
Reputation: felgall is an unknown quantity at this point 
Solved Threads: 1
felgall felgall is offline Offline
Light Poster

Re: "Must visit from" javascript wont work in IE...

 
0
  #9
Nov 27th, 2005
Whether the script works or not can depend on the browser and firewall settings on individual computers. That would be the reason some people say it works and others say it doesn't. You can't rely on document.referrer containing anything as there are too many different ways it can be turned off.
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 92
Reputation: NuGG is an unknown quantity at this point 
Solved Threads: 1
NuGG's Avatar
NuGG NuGG is offline Offline
Junior Poster in Training

Re: "Must visit from" javascript wont work in IE...

 
0
  #10
Nov 30th, 2005
Ok Im going to forget that idea then. Thanks for your help.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC