It's hard to find issues with Safari 7, but I've got a weird one. I'm using pushstate
and popstate
to modify the browser history for an ajax content loader code I've written. The code works fine with the exception of the popstate
code which work in every browser except Safari 7+ . Works fine in Safari 6 and lower.
var popped = ('state' in window.history), initialURL = location.href;
$(window).bind('popstate', function(event){
var initialPop = !popped && location.href == initialURL;
popped = true;
console.log(event.state);
if ( initialPop ) return;
var state = event.originalEvent.state;
$("#loading").show();
$('#contentwrapper').fadeOut('normal').hide().load(state.url + " #contentwrapper > *").fadeIn('slow');
$("#loading").fadeOut();
});
The script works fine in all browsers. In Safari 7, the page loads incorrectly. The normally hidden #loading
div is visible, and the normally visible #contentwrapper
div is hidden. Also getting console error:
TypeError: 'null' is not an object (evaluating 'state.url')
©2020 All rights reserved.