如何防止使用jQuery重新打开新窗口? [英] how to prevent reopening new window using jQuery?

查看:89
本文介绍了如何防止使用jQuery重新打开新窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近在> jQuery如何阻止重新打开新窗口?.在那篇文章中,我提到我需要使用 F2 键.
现在,我想问另一个问题,类似于上面的问题.这次单击链接.
我有一个使用window.open打开新窗口的链接.我想防止用户单击列表中的前一个窗口仍处于打开状态时重新打开新窗口.

I've recently posted a new question in How jQuery can prevent reopening a new window?. At that post, I mentioned to my need for something on F2 key.
Now I want to ask another question similar to the question above; This time for clicking on a link.
I have a link that opens a new window using window.open. I want to prevent user to reopening new window when he clicks on the list if the previous window is still opened.

您的建议是什么?

推荐答案

您可以这样做:



var childWin;
    function winOpen(url)
    {
       //check if child window is already open
       if (childWin &! childWin.closed && childWin.focus){
           childWin.focus();
       } else {
          childWin = window.open(url,'','width=800,height=600');
      }
    }

您的意思是这样的吗

这篇关于如何防止使用jQuery重新打开新窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆