The following are some of the requirements to make yourself do the work, why not, to be a note
I. Prohibition of browser return
stopBack: function () { var that = this,_num=0; if (window.history && window.history.pushState) { $(window).on('popstate', function() { _num++; if(Number(_num)<that.kfh||that.kfh==0){ window.history.pushState('forward', null, document.URL); window.history.forward(1); setTimeout(function () { that.down (); }, 5000 ); } the else { window.history.go ( -1 ); _num = 0 ; } }); window.history.pushState ( 'Forward', null , document.URL); window.history.forward ( . 1 ); } }
// method to enter the page calls stopBack
Second, some of the open environment of the judgment
//判断系统是ios还是安卓 sysTemInfo: function () { var us = navigator.userAgent.toLowerCase(); if ((us.indexOf('android') > -1 || us.indexOf('linux') > -1) || navigator.platform.toLowerCase().indexOf('linux') != -1) { return 'android'; } else if (us.indexOf('iphone') > -1 || us.indexOf('ipad') > -1) { return 'ios'; }else{ return 'pc'; } }, judgment micro-channel is determined// isWeChat: function () { var ua = navigator.userAgent.toLowerCase(); if (ua.match(/MicroMessenger/i) == "micromessenger") { return true; } else { return false; } }, //微博判断 isWeiBo:function(){ var ua = navigator.userAgent.toLowerCase(); if (ua.match(/WeiBo/i) == "weibo") { return true; } else { return false; } },
Third, because the open page in the micro-channel can not be downloaded to the browser to download the guide, so I used the following method
weChatRes: function (n-) { $ ( '.wechat') length && $ ( 'WeChat.'. ) .remove (); var HTML = '<div class = "WeChat"> <IMG the src = "' + n-+ ' "alt =" top right corner, and then select a browser to open "/> </ div>! ' ; $ ( ' body ' ) .append (HTML); }, // the traditional values n, according to Andrews or different ios show different pictures