StudioTime
StudioTime

Reputation: 23979

Determine where pop up window pops up

Is it possible to determine where a pop up is spawned in relation to the browser window? e.g. left, right, top, etc. etc.

I know I can set the size, scrollbars etc

I use the following to open the window:

javascript:(function(){window.open('http://myurl.com/mypage.html')})()

This pop up is spawned from the bookmarks toolbar, therefore a link

Upvotes: 1

Views: 147

Answers (1)

Erwin
Erwin

Reputation: 4817

This is the method syntax:

var windowObjectReference = window.open(strUrl, strWindowName[, strWindowFeatures]);

For position use the left and top parameters, so it will be something like this:

  javascript: (function () {
        window.open('http://myurl.com/mypage.html', 
                    'windowname', 
                    'toolbar=yes,top=10,left=10,width=200,height=200')
    })()

The left, top, width, height are in pixels.

Look at this link for more info:

https://developer.mozilla.org/en-US/docs/DOM/window.open

Upvotes: 1

Related Questions