Re: browser differences, IE, FF, and Opera



ccc31807 <cartercc@xxxxxxxxx> writes:

function clear()
{
var len = history.length;
history.go(-len);
window.location.href = 'myotherURL.com';
}

window.onunload = clear();

Funny thing is that in IE and FF the location gets set to
myotherURL.com as it should but the history doesn't clear, while in
Opera the history clears but the location doesn't get reset.

I'm guessing that the problem is that both history.go and
window.location.href-assignment are navigations. You can only navigate
away from a page once. Whether it's the first or the second navigation
that takes effect appears to differ, but you can't have both.

What gives, and is there any way I can have both behaviors in IE, FF,
and Opera?

If there is, it's a bug that should be fixed, so not something you should
depend on.

The problem is that the behavior you want can also be used destructively.
Executing the script
history.go(-history.length);
window.location.href="yaddayadda.html";
successfully will erase your browsing history for that tab/window.
It might not be much, but it's still a loss.

Instead you could run your entire application inside a full-page
frame, and from the page containing the frame you can clear the
contents and navigate away from the page. It might be closer to
what you want, and possible.

Or, you could have a login page that sets a cookie, and an on-load
event on all following pages that check for that cookie and does
history.go(-1) if it isn't set.
Then on logout (onunload perhaps) you clear the cookie and do
history.go(-1), which moves back through history until it meets
the login page again.

These are just guesses, I have no idea whether it will work in
practice :)

/L
--
Lasse Reichstein Holst Nielsen
'Javascript frameworks is a disruptive technology'

.



Relevant Pages

  • RE: IWebBrowser2 ActiveX control ignoring navNoHistory and putting URLs into the history
    ... We open a IE and navigate to a website A, and click a link to navigate to ... Do not add the resource or file to the history list. ... (unless you specify the NAVNOHISTORY flag when using the Navigate method). ... Microsoft Online Community Support ...
    (microsoft.public.vb.controls.internet)
  • Re: Cant clear www.t-mobile.com from my Ctrl-O funtion in IE6
    ... the culprit of this ONE piece of history stuck in the Ctrl-O window? ... And what is it with t-mobile.com's site that only their cookie (or ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: XP Pro SP2 Cookies and Cache
    ... > temp internet files and history. ... > Question is, if I cleared my cookies, temp internet files and history, how ... address and port, then you are still logged in. ... you have to logon again or use your cookie, if it is used as authentication. ...
    (microsoft.public.windowsxp.security_admin)
  • FormsAuthentication Cookie
    ... Assuming that the local m/c does not have the cookie named ... When a user tries to navigate to Products.aspx without logging in, ... But when the user closes this window, opens a new browser window & ...
    (microsoft.public.dotnet.framework.aspnet)