View Full Version : Stop page refresh

07-12-2009, 08:31 AM
Is there any simple way to stop page refresh in a frame set? So you return to the same frame set page/pages?
(Like firefox does it)
I am slow so bear with me, but I do try to improve.


07-12-2009, 07:27 PM
onbeforeunload event:
not supported in Opera (they're working on it, supposedly)
supported in Safari (can't find an official reference, though)

07-14-2009, 12:56 PM
Thanks but, I think I was a little unclear.
One page in the frame set has a link, witch opens up a page on top, but then you use the return link (history:go(-1)), all pages in the framset refresh, so you lose the status/place in/on the page. I would like to keep the pages in the frame set as they were before you opened the link. Is this possible?


07-14-2009, 04:32 PM
Set the target attribute of the link to one particular frame. If more than one frame needs to be updated, you'll probably have to do that in the window.onload JavaScript of the first page by setting frame.location.href. If the second frame to be updated isn't always known by the first one, you'll have to send some information in the query-string:

If other information needs to be sent the same way:

In the latter case, I have a script for getting the variables out of the URL, similar to what PHP does behind the scenes.

EDIT: Or you may have meant that the entire frameset gets replaced, then the Back button doesn't completely work? You'll have to save the current state somehow... I suggest changing the query string in the link to send the state to PHP, then setting a cookie in PHP. If only one page is to be visited before returning to the frameset, you don't need to set the cookie.

EDIT: Wait, that last suggestion still requires JS... Instead, maybe you could maintain a PHP cookie while the user clicks in-frameset links. You could also maintain a JS cookie of where the scrollbars are. I would just rather not use JS when it's unnecessary.

07-16-2009, 06:28 PM
Sorry about the delayed response.
I am pretty new to coding, and I am afraid you are right, a php cookie might be the solution. It will take me some time to get around to so, for this project I think I will remake the set. Thanks for the effort/pick.