Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top