moving the recording operation ends iphone

Back button operation and the iPhone Safari browser is loaded directly into the cache of the page does not load the js file will not execute ready, onload function, but loading html page will run pageshow events, so there is a fallback action needs to be reloaded js the case may be implemented by the following code: event binding pageshow window.addEventLisener ( 'pageshow', function () {})
function fixSafari(evt){
    var str=navigator.userAgent;
    var isiPhone=str.indexOf("iPhone")!=-1;
    var isSafari=str.indexOf("Safari")!=-1;
    if(isiPhone&&isSafari){
        evt.persisted&&window.location.reload();
    }
}
 
<body onpageshow="fixSafari(event)"> 

Guess you like

Origin www.cnblogs.com/Joans/p/11021930.html