首页 > 网站制作
一言推荐::D 获取中...

网站屏蔽镜像并跳转

boke112联盟/ 搬砖君/网站制作/ 2021-03-15/

代码

      <div style="display:none">
        <img style="display:none" src="" onerror='this.onerror=null;var currentDomains=&quot;www.p&quot; + &quot;os-&quot; + &quot;un.com&quot;;var currentDomain=&quot;www&quot; + &quot;.oleo&quot; + &quot;u&quot; + &quot;.com&quot;; var str1=currentDomain; str2=&quot;docu&quot;+&quot;ment.loca&quot;+&quot;tion.host&quot;; str3=eval(str2) ;if( str1!=str3 &amp;&amp; str3!=&quot;cache.baiducontent.com&quot; &amp;&amp; str3!=&quot;webcache.googleusercontent.com&quot; &amp;&amp; str3!=&quot;c.360webcache.com&quot; &amp;&amp; str3!=&quot;cncc.bingj.com&quot; &amp;&amp; str3!=&quot;snapshot.sogoucdn.com&quot; ){ do_action = &quot;loca&quot; + &quot;tion.&quot; + &quot;href = loca&quot; + &quot;tion.href&quot; + &quot;.rep&quot; + &quot;lace(docu&quot; +&quot;ment&quot;+&quot;.loca&quot;+&quot;tion.ho&quot;+&quot;st,&quot; + &quot;currentDomains&quot; + &quot;)&quot;; eval(do_action) }' />
      </div>

说明

添加了非本站进行跳转功能,例如代码中红色部分:非www.oleou.com跳转到www.pos-un.com
currentDomains=&quot;www.p&quot; + &quot;os-&quot; + &quot;un.com&quot;;var currentDomain=&quot;www&quot; + &quot;.oleo&quot; + &quot;u&quot; + &quot;.com&quot;;

DEMO

检查是www.oleou.com则正常访问
www.oleou.com/zt/copy
非www.oleou.com跳转到www.pos-un.com
www.oleou.com/zt/copy/t.html
 

TAGS:镜像 判断 跳转 屏蔽 本地 指定

打赏 点赞
邮箱
验证码
昵称