IE7 OnHashChanged Fix und Jquery
Die Funktion window.onhashchanged wird leider in allen gängigen Browsern unterstützt außer IE7 abwärts.
Mit folgendem Code können Sie dieses Event beibringen:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |  var = document.documentMode;     // Does the browser support window.onhashchange?     // Note that IE8 running in IE7 compatibility mode reports true for 'onhashchange' in window,�     // even though the event isn't supported, so also test document.documentMode.     ('onhashchange' in && ( === || > 7)) {         //window.onhashchange = checkHash;         $(window).bind('hashchange', () {             CheckHash();         });     }     // IE7 doesn't support the hashchange event so we fall back to standard polling technique     {         //poll = window.setInterval(CheckHash(), 500);         var = window.location.hash;         var = window.setInterval( () {             (window.location. != prevHash) {                 = window.location.hash;                 CheckHash();             }         }, 100);         // Clean-up objects as IE7 has hideous performance         window. = () {             window.clearInterval(poll);         }     } function CheckHash() {     Ihre funktion } |
Und schon läuft alles. Natürlich wäre es einfacher wenn man den IE7 langsam ignorieren könnte, aber wird wohl noch ne weile dauern ![]()




Leave a Reply
Want to join the discussion?Feel free to contribute!