Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    IE vs Firefax Back Button Reload

    Sorry if this is the wrong place for this question, but...

    I'm having an issue with the difference in behavior between the IE and FF back buttons. I'm using jQuery to create collapsable div regions which contain text boxes on a search form. After submit, if the use clicks the back button in FF, the region(s) the user had previously expanded, show as expanded. Also, there search term is still present. In IE, when clicking the back button, all regions are collapsed, in there original loaded state, but the search term is still saved.

    I put the following code at the top of the page:

    onload=function(){
    alert('Onload!');
    }

    When clicking the back button in FF, nothing happens. For IE, the alert pops up. This tells me that IE reloads the page (but somehow still saves some things, like the search text).

    My question is, is there a way to keep IE from reloading when the use clicks 'back'? I will be creating my own 'edit' back button for users to get around this, but I also would like to prevent this from confusing users and causing undesired results.

    Any help would be greatly appreciated.

  • #2
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,798
    Thanks
    19
    Thanked 156 Times in 147 Posts
    My question is, is there a way to keep IE from reloading when the use clicks 'back'?
    Not to my knowledge. You can't change the default behavior of the browser's forward and back buttons.

    Instead, you could use a cookie here to save the state of the collapsable divs and the values of the text boxes inside your divs (on submit of your form). So, when you hit the back button in the browser, if the page reloads, then an onload event handler checks for something in the cookie. If the event handler finds something in the cookie, then those values are used to restore the page to its previous state.

    At some point, if you are using a cookie like this, you would need to delete the data in the cookie -- perhaps in the onunload event of the second page (exactly how you do this will depend on the flow and interface of your web application). This will prevent old values in the cookie from restoring previous states of the form whenever the page loads (aside from when a user hits the browser's back button to arrive there).
    Last edited by chump2877; 12-20-2011 at 04:05 AM.
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!

  • #3
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for the suggestion...I was just thinking of something similar to that after work. I'll try it out.

  • #4
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,798
    Thanks
    19
    Thanked 156 Times in 147 Posts
    Another idea -- if you want to use HTML5 for your project -- is to try the new web storage objects. Another link here. But you have to assume that this will only work for the very latest versions of browsers. If that isn't a limitation for you, then the new objects are easier to use than cookies, and they can store more data.
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!


  •  

    Posting Permissions

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