Forum Moderators: open

Message Too Old, No Replies

Safari kills history with window.location

Loading a new URL destroys the Back button

         

MichaelBluejay

10:40 pm on Jan 29, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Let's say you click a link on Page A,
which takes you to Page B,
where an <onmouseover> takes you to Page C with a <window.location=...>.

At that point hitting the Back button takes you back to page B, as you'd expect, if you're using IE.

But in Mac Safari, you go back to Page A. (Or, if you'd started at Page B by typing its URL directly into a new browser window, then you don't get a Back button at all.)

I'm surprised that I couldn't find anything about this problem in Google. Even if there's a workaround, surely others must have discussed it before. Or maybe I'm doing something unique and others don't run into this problem?

Here's my code:

<A HREF="/biketrip/" onmouseover="window.location='../biketrip/'; return false"><IMG SRC="thumbnails/biketrip-cow.jpg"></A>

Yeah, I know navigating with onmouseover is poor design -- if it makes you feel better pretend it was called by a form. :)

Thanks for any help you can provide.

dcrombie

2:03 pm on Jan 30, 2004 (gmt 0)



The history object should be unique for each window, so opening a new window would start a new history list. The window you were on before should still be sitting behind the one you opened. Does IE (Win) really do that?!?

MichaelBluejay

5:13 pm on Feb 1, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Who said anything about opening a new window? :) I'm using window.location, not window.open. Same window, new url.

-MBJ-

dcrombie

1:15 pm on Feb 2, 2004 (gmt 0)



Try using "self.location.href" instead of "window.location" - Safari tends to be more strict as it's based on the W3C standards rather than the other way around.

MichaelBluejay

8:28 pm on Feb 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I'm afraid neither "self.location" nor "self.location.href" works. Same problem. :(