JavaScript Bookmarklet 打开新窗口并传输原始页面的参数
我有一个完美工作的书签来获取当前网站的文档标题和 URL,并将其放入新加载页面的 URL 中(下面的代码)……现在我想知道如何让这个domain.com/bookmarklet? ...在新的小窗口(600x600px)中打开,这样我仍然可以看到我在后台抓取标题和网址的旧网站,并在新页面(domain.com/bookmarklet?...)前景。
javascript:location.href='http://domain.com/bookmarklet?url='+encodeURIComponent(location.href)+';title='+encodeURIComponent(document.title)
我怎样才能做到这一点?
I have a perfectly working bookmarklet to grab the Document-Title and the URL of the current Website and place it into the URL of the new loaded Page (Code below) … now I wonder how to let this domain.com/bookmarklet?… open in a new small window (600x600px), so that I still see the old website from where I grabed the title and url in the background and have the new page (domain.com/bookmarklet?…) in the foreground.
javascript:location.href='http://domain.com/bookmarklet?url='+encodeURIComponent(location.href)+';title='+encodeURIComponent(document.title)
How can I achieve that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用
window.open(...)
代替设置location.href = ...
。Use
window.open(...)
instead of settinglocation.href = ...
.您需要使用 window.open() 来实现
you need to use window.open() for that