Alert, confirm, and prompt not working after using History API on Safari, iOS

This is because of the back-forward cache in Safari.

You can use the following code to force a reload when the back-button is pressed.

window.onpageshow = function(e) { // e -> event
    if (e.persisted) {
        window.location.reload(); 
    }
};

Additionally, if you are using jQuery …

$(window).bind("pageshow", function(e) { // e -> event
    if (e.originalEvent.persisted) {
        window.location.reload();
    }
});

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)