On - [removed].hash - Change?

后端 未结 13 1384
谎友^
谎友^ 2020-11-21 13:38

I am using Ajax and hash for navigation.

Is there a way to check if the window.location.hash changed like this?

http://example.com/blah

13条回答
  •  眼角桃花
    2020-11-21 13:52

    A decent implementation can be found at http://code.google.com/p/reallysimplehistory/. The only (but also) problem and bug it has is: in Internet Explorer modifying the location hash manually will reset the entire history stack (this is a browser issue and it cannot be solved).

    Note, Internet Explorer 8 does have support for the "hashchange" event, and since it is becoming part of HTML5 you may expect other browsers to catch up.

提交回复
热议问题