Link to home
Start Free TrialLog in
Avatar of hessmac
hessmac

asked on

How to clear the back-button list from IE

I want to clear the dropdown items from the back-button from Internet Explorer.

How/where can i do that

can it be done withj javascript
Avatar of b1xml2
b1xml2
Flag of Australia image

that really can't be done. Becos there is no way to clear the history cached on the client-side by the user.

What you can do is to use javascript to open any links found on your page, so there will only be ONE reference to your site.

<script>
function replaceWindow(szURL) {
 window.location.replace(szURL);
}
</script>

html syntax
============
<a href="javascript:replaceWindow('user.html');">Log On</a>


from msdn
==========
Replaces the current document by loading another document at the specified URL.

Syntax

location.replace(sURL)
Parameters

sURL Required. String that specifies the URL to insert into the session history.

Return Value

No return value.

Remarks

When a document is replaced, it is also removed from the history object. Moreover, the user interface navigation methods, such as the Back and Forward buttons, will no longer access the URL.

you wont be able to clear any references not related to your site.
and if a user types in a url to your site, and has come from other sites, the BACK button is still clickable.
The history collection is read only.  What b1 gave you is the closest control you re going to get.  The other option is to open a new window and the use location.replace to prevent the accumulation of a historical trail.

Cd&
Avatar of webwoman
webwoman

Just to expand on Cd& -- you'll prevent a historical trail for THAT WINDOW ONLY. The history for the main browser window will not be affected.
Avatar of hessmac

ASKER

Thanks fot the info B1.. I dont't like it but thanks anyway.

Is there a way to disable the back-button(and its functionality, I mean als disable the backspace etc to go backwards in history) and write my own back-button with which i CAN control the history.



ASKER CERTIFIED SOLUTION
Avatar of b1xml2
b1xml2
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Sure! Write a new browser that does exactly what you want, and get everybody who might possibly want to ever view your site to download and use it.

Short of that, no.
hessmac, i know that you're not pleased with the answers given but they are correct and deserves the grade A as they are all spot on.
There seems to be a relationship between questioners who want to override security and user preferences to violate their right to use their browser the way they wish; and grading histories that reflect a lack of respect for experts. Maybe it is just coincidence that the lack of respect appears general.....

Cd&

To prevent posting a form twice, I use this technique.

Upon success, my script returns only this instruction, if failed, return a normal page.

<script>
history.go(-1);
location.replace("success.html");
</script>

tested in IE 6 only