我尝试使用书签在 Chrome 中的 URL 开头插入链接。我希望 URL 更改为:
https://raw.githubusercontent.com/kguidonimartins/csv_example/master/1946_proposicoes.csv
收件人:
chrome-extension://ibfcfelnbfhlbpelldnngdcklnndhael/viewer.html?url=https://raw.githubusercontent.com/kguidonimartins/csv_example/master/1946_proposicoes.csv
我把它放在书签的 URL 字段中:
javascript:location=location.href.replace(location,"chrome-extension://ibfcfelnbfhlbpelldnngdcklnndhael/viewer.html?url=" + location)
但是失败了。然后,我尝试了这个:
javascript:(function(){window.open('chrome-extension://ibfcfelnbfhlbpelldnngdcklnndhael/viewer.html?url='+encodeURIComponent(location.href));})();
那也失败了。
知道如何解决这个问题吗?
最佳答案
试试这段代码:
javascript:(function() {
location.href = "chrome-extension://ibfcfelnbfhlbpelldnngdcklnndhael/viewer.html?url=" + location.href;
})();
关于javascript - 将字符串附加到 URL 的书签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53249318/