【发布时间】:2021-10-16 11:38:24
【问题描述】:
我想创建一个小书签,将当前页面的 url 附加到另一个预定义的 url。
javascript:(function(){location.href='example.com/u='+encodeURIComponent(location.href)}());
但是,返回的 url 没有编码,但是当我尝试 encodeURIComponent(encodeURIComponent(location.href)) 时,它起作用了。我不明白为什么加倍 encodeURIComponent 会有所不同?
【问题讨论】:
标签: javascript google-chrome url browser bookmarklet