Javascript Bookmarklet:在头URL之前添加URL
这可能非常简单,但我完全是个新手。我想在URL的开头添加一些内容,如下所示: 原始网址: 使用bookmarklet,我想让URL看起来像这样Javascript Bookmarklet:在头URL之前添加URL,javascript,bookmarklet,Javascript,Bookmarklet,这可能非常简单,但我完全是个新手。我想在URL的开头添加一些内容,如下所示: 原始网址: 使用bookmarklet,我想让URL看起来像这样 javascript:(function() {window.location=window.location.toString().replace(/^https:\/\/www\./,'https://testtool.com/testing-tool#url=https';})() 我试过这样的东西 javascript:(function(
javascript:(function() {window.location=window.location.toString().replace(/^https:\/\/www\./,'https://testtool.com/testing-tool#url=https';})()
我试过这样的东西
javascript:(function() {window.location=window.location.toString().replace(/^https:\/\/www\./,'https://testtool.com/testing-tool#url=https';})()
但它不起作用
你能帮我吗?不知道为什么要替换当前URL并将其作为哈希粘贴
window.location = 'http://www.example.com#url=' + window.location.href
或
什么不起作用?你为什么要更换?为什么你不只是附加它?