JS阻止浏览器返回代码
一段可以阻止浏览器返回的代码,今天无意打开了一个网站,发现怎么也返回不了,仔细研究了一下网站代码找到了无法返回的原因,于是将这段代码提取出来了。
仅供大家学习交流,请勿使用在自己的网站上,这算是一种比较流氓的行为。
<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script>
!(function() {
if (window.history && window.history.pushState) {
$(window).on('popstate', function() {
window.history.pushState('forward', null, document.URL);
window.history.forward(1);
});
}
window.history.pushState('forward', null, document.URL);
window.history.forward(1);
})();
</script> 相关文章
- 使用新浪获取IP所在地接口做网站跳转
使用新浪获取IP接口做网站跳转 title使用新浪获取IP接口做网站跳转/title !--引用新浪IP获取接口-- script type=text/javascript src=http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js/script !--引用新浪IP获取接口-- script type=text/javas
- 标题滚动效果演示
纯JS实现的标题滚动效果。代码如下: 复制代码 代码如下: script type=text/javascript (function(){ setInterval(function(){ text = top.document.title; top.document.title=text.substring(1,text.length)+text.substring(0,1); },500); })(); /script
- HTML图片热区map area谷歌浏览器Google去除边框
HTML图片热区map area去除边框默认的情况下 在Google浏览器中打开的时候周围会有蓝色的边框。 在area中加入以下代码可以去除边框: hidefocus=true onfocus=this.blur(); 完整代码如下: 复制代码 代码如下: img src=http://www.120muban.com/statics/images/l
- 最新获取访客QQ接口—20140915
最新获取访客QQ接口,分析某网站代码得到的最新获取访客QQ的接口,接口地址: http://x.pet.qq.com/vip_platform?cmd=entercallback=aaa 复制代码 代码如下: script window.www120mubancom = scriptfunction aaa(obj){parent.qq(obj);}\/scriptscript src=htt
- JS手机端跳转代码
JS手机端跳转代码,通过判断浏览器版本来判断是手机端还是PC端,然后可以做相应的操作。 能够判断IE内核,opera内核,苹果、谷歌内核,火狐内核,是否为移动终端 ,android终端或者uc浏览器,是否为iPhone或者QQHD浏览器,是否iPad,是否web应该程序,没有头
随机推荐
- 使用新浪获取IP所在地接口做网站跳转
使用新浪获取IP接口做网站跳转 title使用新浪获取IP接口做网站跳转/title !--引用新浪IP获取接口-- script type=text/javascript src=http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js/script !--引用新浪IP获取接口-- script type=text/javas
- 标题滚动效果演示
纯JS实现的标题滚动效果。代码如下: 复制代码 代码如下: script type=text/javascript (function(){ setInterval(function(){ text = top.document.title; top.document.title=text.substring(1,text.length)+text.substring(0,1); },500); })(); /script
- HTML图片热区map area谷歌浏览器Google去除边框
HTML图片热区map area去除边框默认的情况下 在Google浏览器中打开的时候周围会有蓝色的边框。 在area中加入以下代码可以去除边框: hidefocus=true onfocus=this.blur(); 完整代码如下: 复制代码 代码如下: img src=http://www.120muban.com/statics/images/l
- 最新获取访客QQ接口—20140915
最新获取访客QQ接口,分析某网站代码得到的最新获取访客QQ的接口,接口地址: http://x.pet.qq.com/vip_platform?cmd=entercallback=aaa 复制代码 代码如下: script window.www120mubancom = scriptfunction aaa(obj){parent.qq(obj);}\/scriptscript src=htt
- JS手机端跳转代码
JS手机端跳转代码,通过判断浏览器版本来判断是手机端还是PC端,然后可以做相应的操作。 能够判断IE内核,opera内核,苹果、谷歌内核,火狐内核,是否为移动终端 ,android终端或者uc浏览器,是否为iPhone或者QQHD浏览器,是否iPad,是否web应该程序,没有头