| | |
"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 |
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?
Cheers,
NuGG
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<SCRIPT LANGUAGE="JavaScript" > <!-- Begin var requiredfrom = "http://domain.com/somepage.htm"; // required prev. page if (document.referrer.indexOf(requiredfrom) == -1) { alert("You must logon first..."); window.location=requiredfrom; } // End --> </script>
NuGG
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.
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
I'm using Internet Explorer and it worked for me!
Dani the Computer Science Gal 
Follow my Twitter feed! twitter.com/DaniWeb
And if you're interested in Internet marketing there is twitter.com/DaniWebAds

Follow my Twitter feed! twitter.com/DaniWeb
And if you're interested in Internet marketing there is twitter.com/DaniWebAds
Does this javascript work in IE for anyone else?
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.
•
•
•
•
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.
•
•
Join Date: Aug 2004
Posts: 49
Reputation:
Solved Threads: 1
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.
•
•
•
•
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.
The stupidest person in the history of the world. That's me.
•
•
Join Date: Aug 2004
Posts: 49
Reputation:
Solved Threads: 1
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.
![]() |
Similar Threads
- "Must visit from" javascript wont work in IE... (Site Layout and Usability)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: need help requiring at least one checkbox from group to be selected
- Next Thread: Changing link text.
| Thread Tools | Search this Thread |
Tag cloud for JavaScript / DHTML / AJAX
ajax ajaxexample ajaxjspservlets api autoplay blackjack browser bug captchaformproblem checkbox child class close codes cookies createrange() cursor date debugger dependent developer disablefirebug dom dropdown editor element embed engine events explorer ext file flash form forms game getselection google gxt hiddenvalue highlightedword hint html ie7 ie8 iframe images internet java javascript javascripthelp2020 jquery jsf jsfile jump libcurl maps math matrixcaptcha media mp3 mysql object onerror onmouseoutdivproblem onreadystatechange parent passing paypal pdf php player position post programming progressbar rated runtime safari scriptlets scroll search security session shopping size software star stars stretch synchronous tweet unicode variables web webkit webservice window wysiwyg \n






