Differences in Internet Explorer and Firefox when dynamically loading content then going forward and back

前端 未结 3 601
轮回少年
轮回少年 2020-12-11 05:05

I\'m developing a web application where, due to slow database access, not all content in a page is loaded immediately but rather dynamically when the user clicks a button af

相关标签:
3条回答
  • 2020-12-11 06:05

    Here is my workaround solution for IE. It utilizes the fact that, even if the DOM is reset when navigating away and back to a page, input field values are still remembered.

    For every dynamically loaded element, I also have a hidden input field where I "cache" the loaded value. I then have a function transferFromCache() which copies the values from each hidden input field to the corresponding element. This function is run at page init - which, in IE's case, is at page load AND every time one navigates back to the page.

    This technique could probably be used to store the values of javascript variables as well.

    0 讨论(0)
  • 2020-12-11 06:05

    I don't think there's a method to get IE to emulate FF in this manner. The reason is to do with fairly fundamental aspects of the browsers. FF uses a mechanism for it's page history called 'Fast DOM caching' which (from my limited understanding) basically means that when it puts a page into the browser history then it will store the current DOM (so the current page state) in a serialised format, which means that when the page is reloaded from history the state is preserved and FF can do this much quicker as a lot of work is already done (parsing the HTML into a DOM, etc). In comparison, IE will simply store the HTML received initially as it's history file and will reload it when navigating history.

    0 讨论(0)
  • 2020-12-11 06:09

    Here is an article about saving state in session variables, which may help

    0 讨论(0)
提交回复
热议问题