jquery history back button to reset

↘锁芯ラ 提交于 2019-12-12 02:46:51

问题


I am having a problem with my website. I have some animations when a redirect is happening to get a transition effect from page to page. The problem is that if a user clicks the Browsers Back button it goes to the previous page but it does not reset the animations so everything stays hidden as when you exited the page.

To have a demo of the error go to http://www.econtentsys.gr/affiliate/xenosk/temp/amigdalos/main.php , Click on About Me and then click on your browsers (history) Back button.

Is there anyway to reset the pages cache lets say every time the page gets showed so the transitions will always work ?

Only Google Chrome functions properly on me. All the other browsers are having the same error.

Thanks in advance.


回答1:


Your animation doesn't reset when you click the back button because the page is cached in the bfcache (Back-Forward Cache).

The linked article mentions several situations where bfcache is not used, one being when the unload handler is uses. Therefore, the simplest approach would be to simple add an empty onunload attribute to your <body> tag, i.e.

<body onunload="">

p.s. I've only tested this in Firefox.



来源:https://stackoverflow.com/questions/8166208/jquery-history-back-button-to-reset

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!