943,608 Members | Top Members by Rank

Ad:
You are currently viewing page 1 of this multi-page discussion thread
Nov 24th, 2005
0

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

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 1
Junior Poster
NuGG is offline Offline
110 posts
since Feb 2005
Nov 24th, 2005
0

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

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
Reputation Points: 10
Solved Threads: 1
Junior Poster
NuGG is offline Offline
110 posts
since Feb 2005
Nov 24th, 2005
0

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

I'm using Internet Explorer and it worked for me!
Administrator
Staff Writer
Reputation Points: 1422
Solved Threads: 162
The Queen of DaniWeb
cscgal is offline Offline
13,645 posts
since Feb 2002
Nov 24th, 2005
0

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

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...
Reputation Points: 10
Solved Threads: 1
Junior Poster
NuGG is offline Offline
110 posts
since Feb 2005
Nov 25th, 2005
0

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

Does this javascript work in IE for anyone else?

Quote 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.
Reputation Points: 10
Solved Threads: 1
Junior Poster
NuGG is offline Offline
110 posts
since Feb 2005
Nov 26th, 2005
0

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

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.
Reputation Points: 13
Solved Threads: 1
Junior Poster in Training
felgall is offline Offline
50 posts
since Aug 2004
Nov 26th, 2005
0

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

...but it did work for me, IE and FireFox.
Team Colleague
Reputation Points: 227
Solved Threads: 37
Made Her Cry
tgreer is offline Offline
1,697 posts
since Dec 2004
Nov 27th, 2005
0

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

Quote ...
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.
Reputation Points: 10
Solved Threads: 1
Light Poster
Bomba is offline Offline
32 posts
since Oct 2005
Nov 27th, 2005
0

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

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.
Reputation Points: 13
Solved Threads: 1
Junior Poster in Training
felgall is offline Offline
50 posts
since Aug 2004
Nov 30th, 2005
0

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

Ok Im going to forget that idea then. Thanks for your help.
Reputation Points: 10
Solved Threads: 1
Junior Poster
NuGG is offline Offline
110 posts
since Feb 2005

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JavaScript / DHTML / AJAX Forum Timeline: need help requiring at least one checkbox from group to be selected
Next Thread in JavaScript / DHTML / AJAX Forum Timeline: Changing link text.





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC