Created
May 15, 2014 13:20
-
-
Save docluv/51ad2e57fc8a50997ee1 to your computer and use it in GitHub Desktop.
Core Site Redirect using feature detection
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
<script> | |
var ef = "?_escaped_fragment_="; | |
if (!('querySelector' in document) | |
|| !('localStorage' in window) | |
|| !('addEventListener' in window) | |
|| !('matchMedia' in window)) { | |
if (window.location.href.indexOf("#!") > 0) { | |
window.location.href = window.location.href.replace("#!", ef); | |
} else { | |
if (window.location.href.indexOf(ef) < 0) { | |
window.location.href = window.location.href + ef; | |
} | |
} | |
} else { | |
if (window.location.href.indexOf(ef) >= 0) { | |
window.location.href = window.location.href.replace(ef, "#!"); | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment