父頁面初始化:web
$(function () { var hiddenProperty = 'hidden' in document ? 'hidden' : 'webkitHidden' in document ? 'webkitHidden' : 'mozHidden' in document ? 'mozHidden' : null; var visibilityChangeEvent = hiddenProperty.replace(/hidden/i, 'visibilitychange'); var onVisibilityChange = function () { if (!document[hiddenProperty]) { if (localStorage.getItem('newstateChange') == 'yes') { localStorage.setItem('newstateChange', "no"); window.location.reload(); } } } document.addEventListener(visibilityChangeEvent, onVisibilityChange); })
子頁面操做完成增長JS:get
localStorage.setItem('newstateChange', "yes");