清除UC手机浏览器强制在页面中加入的关键词链接
作者:Alpha时间:2019-06-13 阅读数:6862 +人阅读
UC浏览器真特么的烦人,在页面强制插入JS,强制给关键词加入神马搜索链接,通过以下代码可以轻松清除,基于JQ:
function CaoNiMaDeUc(){ $("a").each(function(index, element) { try{ var thishref=$(this).attr("href"); var thisText=$(this).html(); if(thishref.indexOf("uc.cn")>=0){ $(this).replaceWith(thisText); } } catch(e){ } }); $("script").each(function(index, element) { try{ var thissrc=$(this).attr("src"); if(thissrc.indexOf("ucbrowser")>=0){ $(this).remove(); } } catch(e){ } }); }
上面是清除用的函数,页面下载完成执行下面代码:
$(function(){ var pageDATA_ua = window.navigator.userAgent.toLowerCase(); if(pageDATA_ua.indexOf('ucbrowser')>=0){setInterval("CaoNiMaDeUc();",1000);} });
本站所有文章、数据、图片均来自互联网,一切版权均归源网站或源作者所有。
如果侵犯了你的权益请来信告知我们删除。邮箱:595397166@qq.com