3
我想有一个简单的书签,其在任何URL小书签在每个URL
我用的末尾增加了一个简短的参数?clearcache清空内部缓存的末尾添加参数,所以为了不每次键入它,我正在寻找一个简单的解决方案
我的网站是
http://subdomain.mysite.net/
,并与书签我想使URL去
http://subdomain.mysite.net/?clearcache
同样的,更深层次的网页,我想它去
http://subdomain.mysite.net/some-page/?clearcache
我目前正在
javascript:location=location.href.replace(/http:/g,"/?clearcache")
努力,但它不工作
当我点击那书签,我的网址变成
http://subdomain.mysite.net/?clearcache//subdomain.mysite.net/
我觉得我是cl呃,但我只需要专家的一点小建议。 我希望有个答复。 感谢
谢谢。 我使用了一个更简单的版本,这似乎对我的案件起作用。它只是在我的鼻子前面,我错过了它 'javascript:location = location.href.replace(location.href,“?clearcache”)' 我检查了HTTP标头并且URL有?clearcache at结束。我希望它可以帮助其他人 – valdroni
在添加参数之前,最好检查它是否已经存在于URL中。这个修改版本可以这样做:'javascript:void((function(){var loc = location.href; if(loc.indexOf('clearcache')> = 0)return; loc.indexOf(“?”)<0 ?(location.href = loc +“?clearcache”):(location.href = loc +“&clearcache”);})());' –
谢谢大家。我拿了@valdroni最简单的版本 – elbaulp