【发布时间】:2014-06-09 21:37:36
【问题描述】:
$(window).on('popstate', function(){
window.history.go(-1);
});
当用户单击返回按钮时,我有一个页面使用 popstate
但在某些浏览器中,popstate 会在页面加载时触发,而不是单击返回按钮。
它发生在 Safari 和触摸设备中。
【问题讨论】:
-
我认为这对你有用。单击 [popstate-fire-on-page-load-issue][1]。 [1]:stackoverflow.com/questions/15896434/…
标签: javascript jquery