How to detect change of window hash?
问题 How can you detect a window.location.hash onchange, for example I could do this: if(window.location.hash.hasChanged()) { // ajax stuff } else { // nothing, no hash has been changed (without any window reload) } If I change the hash, e.g. edits and change the hash by pressing enter after editing nothing happens, only on a window reload will detect a change in the hash. 回答1: Ben Alman's hashchange jQuery plugin provides the ability to monitor the hash for changes. 回答2: Most recent browsers (FF3