www.webdeveloper.com
Results 1 to 4 of 4

Thread: Is there any way that I can do this?

  1. #1
    Join Date
    Jun 2011
    Posts
    4

    Is there any way that I can do this?

    Hello,

    Let's say you are on A page.
    You clicked one link on A page to go to B page with querystring like this (B?wow=1234)
    You are currently on B?wow=1234 page.
    You press "BROWSER BACK BUTTON". It goes to A page, however, what I want to is that I want to redirect to "A?wow=1234", not just A page.
    Obviously, there are couple of alternative ways like I can create a link on B page so that user can click that link instead. However, that's not possible option. Also, no use ActiveX or any third-party.
    Minimum requirement is at least this should work IE & FF.
    I can't think of any way.....I wasn't able to capture "Browser Back Button"...
    Also I wasn't able to access history object value(I guess due to security reason)....referrer doesn't have value when pressing "Back button"..
    Any idea?

    Thanks

  2. #2
    Join Date
    Dec 2002
    Location
    St. Louis, MO, USA
    Posts
    1,582
    You can create a sesssion cookie (a cookie without an expire date - it will disappear when the browser is closed) and check for it on A. If it doesn't exist, no URL parameter; if it does exist, place the url NVP (name value pair) as the value of the cookie and redirect to A?wow=1234.

  3. #3
    Join Date
    Jun 2011
    Posts
    4
    That may work, but the problem is that....
    on A page, on page load, you check cookie, and then redirect...which is going to be same A page with querystring...then ...again..it fires the event...redirect to that page...which will be redirecting to that page recursively...

  4. #4
    Join Date
    Dec 2002
    Location
    St. Louis, MO, USA
    Posts
    1,582
    So you include as part of the conditional to check for the indexOf "?" in document.URL; if it does not exist (==-1), redirect; if it does exist, do nothing.
    Last edited by WolfShade; 06-17-2011 at 04:09 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles