admin管理员组

文章数量:1562456

UC浏览器真特么的烦人,在页面强制插入JS,强制给关键词加入神马搜索链接,通过以下代码可以轻松清除,基于JQ:

function CaoNiMaDeUc(){
	$("a").each(function(index, element) {
		try{
        var thishref=$(this).attr("href");
		var thisText=$(this).html();
		if(thishref.indexOf("uc")>=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);}
});


本文标签: 关键词浏览器页面链接手机