函数打开没有弹出窗口阻止程序的链接

函数打开没有弹出窗口阻止程序的链接

本文介绍了Javascript window.open()函数打开没有弹出窗口阻止程序的链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Javascript window.open()函数打开没有弹出窗口拦截器的链接,我想从javascript打开一些链接 window.open()函数但它在firefox,chrome,safari上被阻止。

Javascript window.open() function opens link without popup blocker, I want to open some links from javascript window.open() function but it get blocked on firefox, chrome, safari.

如何通过javascript代码取消阻止弹出窗口,以便在新选项卡中打开

How Can I unblock popup through javascript code so that it will opens up in new tab

我的代码是:

    function GoUrl(id) {
        var string = 'select#' + id + ' option:selected';
        var value = $(string).val();
        if (value != "links") {enter code here
           window.open(value, '_blank');
            window.focus();
        }


推荐答案

刚刚找到答案不同的主题,以为我和你们分享了这个, ONLY 绕过弹出窗口拦截器的方法是通过 onclick 事件,我遇到的问题是我有 onmousedown 相反,我只是简单地将它改为onclick,并且繁荣!立即工作!

Just found the answer from a different thread, thought I shared this one with you guys, the ONLY way to bypass the popup blocker is through the onclick event, the problem I was having was that I had onmousedown instead, I just simply changed it to onclick, and boom! worked instantly!

这篇关于Javascript window.open()函数打开没有弹出窗口阻止程序的链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 12:56