开发者

Position javascript window.open centered on secondary screen?

开发者 https://www.devze.com 2023-03-25 12:14 出处:网络
I have this code from an example: <script type=\"text/javascript\"> function open_and_move2(){ win3=window.open(\"page.htm\",\"\",\"width=开发者_运维知识库600,height=500\")

I have this code from an example:

<script type="text/javascript">
function open_and_move2(){

win3=window.open("page.htm","","width=开发者_运维知识库600,height=500")
win3.moveTo(screen.width/2-300,screen.height/2-250)
}
</script>

It works just fine with the exception that, if the browser window is located at a secondary screen, the javscript window pops up on the main screen.

Seems like the calculated offsets would be correct for the secondary screen, but the offsets are executed on an absolute scope.

I would like to have a window open on click positioned in the middle of the current screen or current window.

How can I do that?

The reason is that I am implementing single sign on for a website and this should be used for a comments plugin.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号