When page is loaded from bfcache it is set to true. Instead you can check the persisted property of the onpageshow event. The popularity of the Safari browser exploded with the iPhone and the iPad, and currently has about a 54 market share of mobile browser usage in the United States. When page is loaded for bfcache onload event wont be triggered. Safari web browser is the default for the iPhone, iPad, and macOS, first released by Apple in 2003 and briefly offered on Windows from 2007 to 2012. This is different from normal cache which only caches HTML code. When user navigates back with back button page can be loaded from cache very quickly. It is supposed to save complete state of page when user navigates away. Your problem is caused by back-forward cache. I ran into this on a recent project, and one of my colleagues stumbled upon this explanation and solution from Mika Tuupola on StackOverflow: I’m not sure if this should be called a bug or not, but it sure feels like one. But this “quirk” shows them their old content that was visible when they were logged in anyways. You would expect that they can no longer see content that requires them to be logged in. On dynamic web apps where content changes, it can be problematic.įor example, imagine if a user logs out, then clicks the back button. On web pages with static content, this is great for performance. I think this is a performance trick in Safari to make web pages load faster when jumping forwards and backwards through browser history. See how the time actually jumps back instead of showing the current time? Why this happens If you navigate from one page to another in a web app, and then click the back button, Safari loads the entire previous view as a cached version of it’s previous state rather than refreshing the content.ĭownload the files, then open 1.index in Safari.Ĭlick the Next Page link, then use the browser’s back button to go back. Fixing Safari's back button browser cache issue with vanilla JS
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |