2011-06-09 56 views
0

我有这个问题。具体的网站,我已经访问了数以千计的网页。我已经启用的CSS走访突出,所以我不浪费我的时间要回我已经看到那么页面的链接...网站改变其URL结构Chrome扩展帮助:在页面加载时替换URL字符串

它使用的是:现在http://www.blah.com/example.phtml?blah&bleh&hit=10&fromsearch 成为http://www.blah.com/example.phtml?blah&bleh&hit=10&fromsearch&hit_id=10

混淆了访问过的页面。

现在访问的页面文件chrome使用的是加密的,所以我不能注入“hit_id = 10”到我所有的浏览历史记录中,因此我想知道是否可以用扩展名做相反的处理。 即在页面呈现时从所有链接中去除“hit_id = 10”的所有实例。我可以找出JS

< script type="text/javascript" > 
document.body.innerHTML = document.body.innerHTML.replace(new RegExp("&hit_id=10", "g"), ""); 
</script> 

我无法弄清楚是如何得到执行(如果可以),它从一个特定的域

PS是& hit_id = 10加载所有网页是作为一个字段

任何/所有帮助赞赏

+0

难道是足以改变'里面只''标签href'财产,或者你想其他的标签,里面替换好? – serg 2011-06-09 21:21:42

回答

4

这将只从链接中删除它完全是多余的:

个content_script.js:

var el = document.getElementsByTagName("a"); 
for(var i=0;i<el.length;i++){ 
    el[i].href = el[i].href.replace("&hit_id=10", ""); 
} 

manifest.json的:

{ 
    ... 
    "content_scripts": [ 
    { 
     "matches": ["http://www.blah.com/*"], 
     "js": ["content_script.js"] 
    } 
    ], 
    ... 
}