Results 1 to 5 of 5

Thread: Stop page refresh

  1. #1
    Join Date
    Jul 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Stop page refresh

    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.

    lodger

  2. #2
    Join Date
    Jul 2006
    Posts
    497
    Thanks
    8
    Thanked 70 Times in 70 Posts

    Default

    onbeforeunload event:
    https://developer.mozilla.org/en/DOM...onbeforeunload
    http://msdn.microsoft.com/en-us/libr...07(VS.85).aspx
    not supported in Opera (they're working on it, supposedly)
    supported in Safari (can't find an official reference, though)
    -- Chris
    informal JavaScript student of Douglas Crockford
    I like wikis - a lot.

  3. #3
    Join Date
    Jul 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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?

    lodger

  4. #4
    Join Date
    Jul 2006
    Posts
    497
    Thanks
    8
    Thanked 70 Times in 70 Posts

    Default

    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:
    somepage.html?secondUrl

    If other information needs to be sent the same way:
    somepage.html?second=url&other=something

    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.
    Last edited by Jesdisciple; 07-14-2009 at 04:47 PM.
    -- Chris
    informal JavaScript student of Douglas Crockford
    I like wikis - a lot.

  5. #5
    Join Date
    Jul 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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.

    lodger

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •