简体   繁体   English

JavaScript书签打开新窗口并传输原始页面的参数

[英]JavaScript Bookmarklet to open new Window and transmit params of origin Page

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. 我有一个运行良好的书签,可以抓取文档标题和当前网站的URL,并将其放入新加载的页面的URL(下面的代码)中……现在,我想知道如何让domain.com/bookmarklet打开?在一个新的小窗口(600x600px)中,这样我仍然可以在后台看到旧的网站,在该网站上抓取标题和URL,并在前台显示新页面(domain.com/bookmarklet?...)。

javascript:location.href='http://domain.com/bookmarklet?url='+encodeURIComponent(location.href)+';title='+encodeURIComponent(document.title)

How can I achieve that? 我该如何实现?

使用window.open(...)而不是设置location.href = ...

您需要使用window.open()

javascript:window.open ("http://domain.com/bookmarklet?.......","MyBookmarklet");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM