小编rjm*_*a13的帖子

Greasemonkey/Tampermonkey 脚本重定向到双重修改的 URL

目标页面的 URL 为:   ouo.io/tLnpEc.html

我想将网址更改为:ouo.press/tLnpEc

即:.ioto.press和remove .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);
}
Run Code Online (Sandbox Code Playgroud)

我希望有人可以帮助解决这个问题。

javascript url greasemonkey userscripts tampermonkey

3
推荐指数
1
解决办法
1万
查看次数