【发布时间】:2018-09-14 10:48:35
【问题描述】:
目标页面的 URL:ouo.io/tLnpEc.html
我想将 URL 更改为:ouo.press/tLnpEc
即:.io 到 .press 并删除 .html。
我已经有了这个,但它不起作用(它重定向到 ouo.press 但仍然不删除 .html):
var url = window.location.host;
if (url.match("//ouo.io") === null) {
url = window.location.href;
if (url.match("//ouo.io") !== null){
url = url.replace("//ouo.io", "//ouo.press");
} else if (url.match("/*.html") !== null){
url = url.replace("/*.html", " ");
} else {
return;
}
console.log(url);
window.location.replace(url);
}
我希望有人可以帮助解决这个问题。
【问题讨论】:
标签: javascript url greasemonkey userscripts tampermonkey