javascript variables persisting across a reload?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Andy Fish

    #1

    javascript variables persisting across a reload?

    Hi,

    Can anyone tell me if there is a way to set a variable in javascript and
    have that persist so that it can be picked up by the next page in the
    window?

    In this case I will actually navigate to the page myself by setting
    document.URL. I am happy to do this in a different way but I don't want to
    pop up a sub window. I want to pass some javascript stuff into the next page
    without having to serialize it all and post it to the server.

    Andy



  • Martin Honnen

    #2
    Re: javascript variables persisting across a reload?



    Andy Fish wrote:[color=blue]
    > Hi,
    >
    > Can anyone tell me if there is a way to set a variable in javascript and
    > have that persist so that it can be picked up by the next page in the
    > window?
    >
    > In this case I will actually navigate to the page myself by setting
    > document.URL. I am happy to do this in a different way but I don't want to
    > pop up a sub window. I want to pass some javascript stuff into the next page
    > without having to serialize it all and post it to the server.[/color]

    You would need to redesign your web page to use a frameset, then you can
    store variables in
    top.varName
    and they are persisted as long as only the frame with your content is
    changed.



    --

    Martin Honnen
    http://JavaScript.FAQTs.com/

    Comment

    • Andy Fish

      #3
      Re: javascript variables persisting across a reload?

      thanks

      I think I will do something similar to your suggestion but use window.opener
      instead since my window has a 'parent'

      "Martin Honnen" <Martin.Honnen@ t-online.de> wrote in message
      news:3F409B24.5 090708@t-online.de...[color=blue]
      >
      >
      > Andy Fish wrote:[color=green]
      > > Hi,
      > >
      > > Can anyone tell me if there is a way to set a variable in javascript and
      > > have that persist so that it can be picked up by the next page in the
      > > window?
      > >
      > > In this case I will actually navigate to the page myself by setting
      > > document.URL. I am happy to do this in a different way but I don't want[/color][/color]
      to[color=blue][color=green]
      > > pop up a sub window. I want to pass some javascript stuff into the next[/color][/color]
      page[color=blue][color=green]
      > > without having to serialize it all and post it to the server.[/color]
      >
      > You would need to redesign your web page to use a frameset, then you can
      > store variables in
      > top.varName
      > and they are persisted as long as only the frame with your content is
      > changed.
      >
      >
      >
      > --
      >
      > Martin Honnen
      > http://JavaScript.FAQTs.com/
      >[/color]


      Comment

      Working...