【发布时间】:2019-04-14 09:58:50
【问题描述】:
我尝试使用书签在 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));})();
那也失败了。
知道如何解决这个问题吗?
【问题讨论】:
-
抛出什么错误?
-
没有错误。当我点击书签时,它只是不会更改 URL。
标签: javascript url bookmarklet