Access the answers to your technology questions today.
Subscribe Now
30-day free trial. Register in 60 seconds.
What Makes Experts Exchange Unique?
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.
Try it out and discover for yourself.
Subscribe Now
30-day free trial. Register in 60 seconds.
Join the Community
Give a Little. Get a Lot.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Join the Community
by: mvan01Posted on 2006-10-31 at 11:48:19ID: 17844796
Hi fizch,
hings;"). Include a message on your page to not use the browser back button, but include one on your page, to go back the correct number of pages (e.g.: onclick="history.go(nPages );".
ment.locat ion.href) var nPages=1;
Due to security reasons, you cannot review the entries of the history object. (Would it be 'secure' to let any random website to which you surf dump the entire contents of where you've surfed since you opened your browser? I don't think so.)
You can, however use: history.go(n); where n is how many pages to go back.
So, create a global JavaScript variable by declaring it outside of any functions. Set it initially to 1 (e.g.: var nPages=1;). When you submit, first increment the variable, so that it will be set to 2 (e.g: onclick="nPages++;doOtherT
Finally, when you submit and the page reloads, you don't want to reinitialize the variable to 1, so instead of:
var nPage=1;
you need:
if(document.referrer!=docu
Note that if the user doesn't heed your message and instead clicks the browser's back button, the page appears to go nowhere, so they'll probably want to follow your directions. (Of course, then if they do, they'll be going back 2 from the first page, and maybe be sent too far???)
Peace and joy. mvan