jquery open window but only when window is not opened already; then show it in front of other windows?

此生再无相见时 提交于 2019-12-11 16:27:37

问题


Would it be possible to have on click div open a window but only if that window hasn't opened before? Not modal but just a regular window with a certain size say 300x300.

I have this Jsfiddle but not fully working yet. The idea is to have 1 popup window and just push it in the front if its already opened.

http://jsfiddle.net/BC9Rd/


回答1:


You can use something like this:

$("#element_id").click(function(){
  window.open ("http://your-domain.com/your-url.html","my_window","menubar=1,resizable=1,width=350,height=250");
});

Basically every time you execute this window.open command, the same window will be utilized because of the same window name ("my_window" in this case)...

I hope this helps :)



来源:https://stackoverflow.com/questions/11250591/jquery-open-window-but-only-when-window-is-not-opened-already-then-show-it-in-f

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!