I trying to bookmark a popup window link as a popup window rather then just a normal bookmark link something like so:

javascript:window.open('http://www.google.com','popupwindow','width=753,height=617')

So when you put it in the address bar or as a bookmark it will open the link as a popup window. So far i manage to get it working but the current tab which i am on also get's loaded with this printed on the page:

[object Window]

Is there anyway to stop it from affecting the current page?

I'm trying to do this on Mozilla Firefox.

有帮助吗?

解决方案

You could wrap it in void()

javascript:void(window.open('http://www.google.com','popupwindow','width=753,height=617'))

window.open returns a Window object. That result is then being written to the page. void() will mask the Window and return undefined instead, which the browser will not write to the page.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top