disabling back and forward button using included javascript file
B Bhutta
Greenhorn
Joined: Jun 28, 2002
Posts: 14
posted
0
Hi, I want to disable my back and forward buttons and I want to use an included file to call that function. If I simply add this line of code: "history.forward();" It will work and there is no problem. However, in this case I have to add this line of code on each hmtl page. However, since we have a common javascript file, common.js, I created a method in this file as: "function clearHistory() { history.forward();}" and I included this file using : script src="common.js" and I call clearHistory method in onLoad mehtod of an html page "(on_Load="javascript:clearHistory();" )" but it doesn't work. Does javascript source file doesn't get included before onload!
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15003
posted
0
If you have control over the links, you can use document.location.replace that will overwrite the history of the current page. alos look at this http://www10.brinkster.com/A1ien51/basics/backbutton.htm The onload event occurs after the entire page is loaded! Eric
subject: disabling back and forward button using included javascript file