Created
June 5, 2015 14:34
-
-
Save zacechola/20a98296ece858fbcf0e to your computer and use it in GitHub Desktop.
Polyfill history.js using Modernizr
This file contains hidden or 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
Modernizr.addTest('history', function() { | |
var ua = navigator.userAgent; | |
if ((ua.indexOf('Android 2.') !== -1 || | |
(ua.indexOf('Android 4.0') !== -1)) && | |
ua.indexOf('Mobile Safari') !== -1 && | |
ua.indexOf('Chrome') === -1 && | |
ua.indexOf('Windows Phone') === -1) { | |
return false; | |
} | |
// Return the regular check | |
return (window.history && 'pushState' in window.history); | |
}); | |
if (!Modernizr.history) { | |
yepnope('/path/to/history.js'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment