javascript监听手机返回键 <pre> if (window.history && window.history.pushState) { $(window).on('popstate', function() { var hashLocation = location.hash; var hashSplit = hashLocation.split("#!/"); var hashName = hashSplit[1]; if (hashName
/** * 监听浏览器标签页的显示与隐藏 */ class ListenerPageVisibility { constructor () { // 设置隐藏属性和改变可见属性的事件的名称 this.hidden = '' this.visibilityChange = '' if (typeof document.hidden !== "undefined") { // Opera 12.10 and Firefox 18 and later support this.hidden