[Lavanya Deepak] Lavanya Deepak
Technology for Better Business and Higher Standards of Life

Wednesday, October 08, 2008

An effective way to Null-And-Void Browser Back Button Effect

An effective way to Null-And-Void Browser Back Button Effect

Handling browser back buttons is always been a great nightmare for web developer fraternity worldwide. But a little fiddling into JavaScript, can get one a great asset that helps one to tide over this issue. The location object of JavaScript has a method called replace which takes a URL as a parameter. When invoked, it replaces the current history entry with the new one and hence the browser back button item would actually contain the new URL.

Example:

1) You are currently in http://www.yourwebsite.com/test.html .
2) In window.onLoad, call
location.replace("test2.html")

The web browser would move into test2.html however, the back button would no longer contain an entry for test.html. You can inspect the contents of history in back button by pulling the small arrow in the browser back button.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home