stock quote

5/15/08

Disable web browser back and refresh button in Javascript

use:

lt%body%gt
onload="window.history.forward(1);">
... BODY CONTENT ...
lt%body%gt

From: http://forum.java.sun.com/thread.jspa?threadID=641697&tstart=0
"
Actually window.history.forward(1) would push the current page ahead in the "visited pages history". A negative number like -1 would restore the previous visited page from browser's cache. Zero is relative to the current (displayed) page. Positive numbers would navigate forward.
If the page number (positive) does not exist in history, your browser will create an entry "copying" the current page to it and setting it as the current entry, so that the previous and actual are the same.

Using window.history.forward(1) does not disable "Back button". The button will work BUT as this script runs on page loading, it will send you "ahead" the history, which stored URL (or page) is the same. So it works like a "Refresh" button, without actually refreshing content from server, but just restoring from cache."

Some other methods used in HTML:
http://www.htmlgoodies.com/tutorials/buttons/article.php/3478911

Disable the refresh button:
http://forum.java.sun.com/thread.jspa?threadID=434163&messageID=1947210

No comments: