Does anyone know of a library that determines if pushState can be used?
I was using this:
if(window.history.pushState){
window.history.pushState(
Looking at the Modernizer source code this is how it checks for push state:
tests['history'] = function() {
return !!(window.history && history.pushState);
};
So a simple way for you would just be:
var hasPushstate = !!(window.history && history.pushState);
One must first check for the existence of window.history before going two levels deep and that's probably why you were experiencing an error.