View Full Version : "Must Vist From..." JavaScript

10-02-2008, 11:18 PM
Please help me with this script. I've tried repeatedly to get this script to work. If a subpage (page2) on my site is linked directly, this script is suppose to redirect the browser to the home page (page1). But when page2 IS opened from page1, instead of showing page2, it directs the browser back to page1.

Still with me?

page2 opens up in a new window.
it opens as its suppose to, but it shows page1 with
the address bar showing the address for page2
so im REALLY confused!

here is an example of whats going on...




Script Name: Must Visit From...

Description: If other sites links directly the sub-pages of your site or if previous required pages are being skipped, you can now require your visitors to come from a certain page! Those that did not come from the required page are alerted then sent back to the required previous page. Clever!


1. Copy the coding into the HEAD of your HTML document -->

<!-- STEP ONE: Paste this code into the HEAD of your HTML document -->



<!-- Begin
var requiredfrom = "index.html"; // required prev. page
if (document.referrer.indexOf(requiredfrom) == -1) {
alert("You must come to this page from " + requiredfrom);
// End -->



Thanks in advance for your help.

10-06-2008, 06:04 AM
I know there is someone on this forum with the brain power to help me.
!! Please, Please, Please Help !! With suger on top!!

Someone told me today my problem could be that im working in frames...
Could this be my the reason this script isnt working for me?

If you cant help me out with this script... Maybe, YOU...
(Yeah you! The person reading this post.)
Maybe you can point me in the direction of a WORKING redirect script.