Clearing History of Browser

I want to make the Browser back button diasable each time a new page is loaded. Basically I think that if there is no history there will be no enabled Back button. How it is possible in IE and Netsacpe.

Thanks in advance
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I think the only way you can do something like this is if the new pages are loaded via JavaScript using the "replace()" method.  The JavaScript syntax is:


This will change the page and overwrite the current entry in the history.  It will not work for entries typed into the address window, and it is not supported by IE3.

Nathan Stanford SrSenior ProgrammerCommented:
Are you simply trying to keep people from hitting the back button and getting old data not a fresh page?
pudcsAuthor Commented:
Possibly YES but I have tested this out , it has some risks that I want to avoid by disabling the Back button.
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!


Your answer to nathans' question was not clear.  You say you have tested this out, but you do not indicate what you have tested.

The question was, "What exactly are your trying to accomplish by disabling the Back button?  Do you want to prevent reloading the page, or is the page a form which might be reloaded with 'stale' data or even reloaded and resubmitted?"

If the issue is one of data, you can solve this quickly by resetting the form when the page loads:

<body onload="document.form.reset()">

My previous comment about replace() will prevent the page from being loaded at all via the Back button.

It is not possible.  Because when you disable the History, the browser does not keep a record of where you have been.  However, when the browser is open, it keeps a sort of "temporary history".  So it is impossible to disable the Back button.  Sorry.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
pudcsAuthor Commented:
I accept the answer but it leaves me from where I start, that it is not possible to disable the Back button of browser by clearing the history of browser.

Thanks anyway
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.