HTML5 onpopstate on page load

前端 未结 6 1786
一整个雨季
一整个雨季 2020-12-06 06:18

I\'m using the new HTML5 onpopstate event. Using Firefox 4 the window.onpopstate event is triggered on a page load whilst in Webkit this does not seem to be the case.

<
6条回答
  •  时光取名叫无心
    2020-12-06 07:17

    I don't know if is this what you are asking, but my solution for an ajax-only onpopstate event handler is to set up to true a variable refreshed on window.onload and set it to false on history.pushState calls; then on the onpopstate handler just do stuff if refreshed is false.

    Looks silly, and it is, but I couldn't do any better.

提交回复
热议问题