history.back(-1) and refresh @ same time

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bsonline
    New Member
    • Oct 2007
    • 21

    history.back(-1) and refresh @ same time

    I want to use history.back(-1) and refresh the page at same time ..
    like with history.back(-1) event when the destination page is displayed at that it also be refreshed.
    is this possible ?
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    hi ...

    that would be useless ... just read the previous url from the history and set the location of the window/frame like:

    [CODE=javascript]window.location .href = 'your_previous_ url_from_histor y';[/CODE]
    kind regards

    Comment

    • bsonline
      New Member
      • Oct 2007
      • 21

      #3
      Originally posted by gits
      hi ...

      that would be useless ... just read the previous url from the history and set the location of the window/frame like:

      [CODE=javascript]window.location .href = 'your_previous_ url_from_histor y';[/CODE]
      kind regards

      how can I get the history????

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5390

        #4
        the previous url might be retrieved through:

        [CODE=javascript]window.location .href = document.referr er;[/CODE]
        to avoid caching you could use:

        [CODE=javascript]window.location .href = document.referr er + '?' + (+ new Date);[/CODE]
        which adds a unique timestamp to the request ...

        kind regards

        Comment

        Working...