javascript popup window remember last size and position
I am opening pop-up window through JavaScript with resize option for end user. End user may resize pop-up window or change its default position by dragging it.
I have requirement of remembering last position and size of pop-up window when user closes the window.
At present I can keep last size of the pop-up window in onbeforeunload event using cookie. But still could not find last position of the window.
Am I missing something very obvious, or what I am doing is the correct开发者_Python百科 way to do it.
The function window.open() returns a handler to the opened window.
var myWindow = window.open('some_url','some_name');
You could maybe then use the myWindow
to obtain its position.
Make a try with window.screenLeft/window.screenTop
on IE and window.screenX/window.screenY
in other browsers to get the positon.
Hope this helps, d.
Finally I used cookie solution to remember position of last open window.
精彩评论