Created
September 16, 2010 00:07
-
-
Save cowboy/581734 to your computer and use it in GitHub Desktop.
How does IE6/7 "back button" support work?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// From http://a5.twimg.com/a/1284588078/javascripts/phoenix.bundle.js | |
(function (B) { | |
var A = (function () { | |
var E = { | |
select: "input", | |
change: "input", | |
submit: "form", | |
reset: "form", | |
error: "img", | |
load: "img", | |
abort: "img" | |
}, | |
C = {}; | |
function D(F, I) { | |
var H = (arguments.length == 1); | |
if (H && C[F]) { | |
return C[F] | |
} | |
I = I || document.createElement(E[F] || "div"); | |
F = "on" + F; | |
var G = (F in I); | |
if (!G && I.setAttribute) { | |
I.setAttribute(F, "return;"); | |
G = typeof I[F] == "function" | |
} | |
I = null; | |
return H ? (C[F] = G) : G | |
} | |
return D | |
})(); | |
B.fn.hashchange = function (D) { | |
if (A("hashchange", window) && (document.documentMode === undefined || document.documentMode > 7)) { | |
this.bind("hashchange", D) | |
} else { | |
var C = location.hash; | |
setInterval(function () { | |
if (C !== location.hash) { | |
D(B.Event("hashchange")); | |
C = location.hash | |
} | |
}, 250) | |
} | |
return this | |
} | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment