我想将网址从"http://example.com/products/description/product123/index.html"更改为"http://example.com/f123456/products/description/product123/index.html".对于来自特定站点(只有一个)的每个链接,我需要像在示例中那样更改,在链接的基础之后添加代码,之后继续使用普通链接.
而更具体的,这里是我想用我的脚本来修改链接:http://www.f64.ro/是http://www.f64.ro/f444618/的每一个环节,产品等.
我尝试了一些我找到的东西,但它不起作用,我不知道出了什么问题.
// ==UserScript==
// @name F64.ro
// @include http://www.f64.ro/*
// ==/UserScript==
var targID = "f444618/";
var targLink = document.querySelector ("#" + targID);
targLink.href += targID + "\/";
Run Code Online (Sandbox Code Playgroud)
谢谢!