PDA

View Full Version : frameset and URL in address bar



molendijk
12-07-2007, 12:36 PM
Hello everybody,
I'm experimenting with framesets and noticed that:
<a href="bla.html" onclick='top.location.href="#bla.html"'>bla</a>
gives me a new URL in the top location bar (as desired), even if the targeted frame is not _top (but the main frame).
Now, this method adds an extra entry to the history. That is, if I have, for example, '../index.html' in the address bar (and 'index.html' in the main frame) before clicking on the bla link, then, after clicking on the bla-link, I have '..index.html#bla.html', then if I go back (back button) I still have the content of bla.html in the main frame, but the URL in the address bar has already returned to '../index.html'. I have to do an extra 'back in history' to get 'index.html' in the main frame again.
In other words, the method works well, except for the extra entry I want to get rid of (in the history queue). (The replace-method doesn't work here, since it deletes the history). Any ideas on how to solve this?

Thanks,
Arie Molendijk.

jscheuer1
12-07-2007, 02:58 PM
Not sure I get you. The location.replace method only gets rid of the current page's spot in the history, replacing it with the new page. It doesn't wipe out the entire history.

Frames are being deprecated though, and these sort of issues may well be one of the reasons.

molendijk
12-07-2007, 05:21 PM
You're right about replace!.
I'm experimenting with framesets, since we would have the same problems with iframes. What I am actually after is the possibility of loading a page in an iframe (with 'target="main"' (not:_top)), then have the URL of the top location bar adapt to the URL of the document loaded in the iframe, where the 'adaption' must be achieved without a reload of the parent page (that contains the iframe).

Arie Molendijk.