【问题标题】:jQuery pop up window in background [duplicate]jQuery在后台弹出窗口[重复]
【发布时间】:2013-03-11 07:09:36
【问题描述】:

我的网页中有一个带有id="icontainer" 的 div,当用户点击它时,会在新标签页中打开一个新网址,并且用户会留在新标签页中。

当用户点击我的 div 时,怎么可能在浏览器后台或新标签页中打开新网址,但用户仍留在我的网页中?

我的代码:

<script type="text/javascript">
$(document).ready(function() {
    $("#icontainer").click(function() {
        $("#icontainer").hide();
        var link = 'http://www.youtube.com/42/16022/15176/" alt="" border="0">';
        var mer_window = window.open(link, '_blank', 'toolbar=1,location=1,directories=1,scrollbars=1,resizable=1,status=1,menubar=1');
    });
});
</script>

【问题讨论】:

  • 我不确定这是否可能,但它肯定会造成令人讨厌的用户体验,只是我的 2 美分
  • 是的,我注意到了这个帖子,但它不起作用......所以有什么想法吗?
  • 请不要这样做。
  • 我想试试@scott.korin 有没有可能实现它?

标签: javascript jquery


【解决方案1】:

这称为弹出窗口。我强烈建议你不要这样做。我从来没有看到这样做的充分理由。

如果需要,这里有一个解释代码的网站。

香草 http://www.htmlgoodies.com/beyond/javascript/article.php/3471241/So-You-Want-A-Pop-Under-Window-Huh.htm

jQuery https://github.com/hpbuniat/jquery-popunder

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-04-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多