window.open与弹出式窗口拦截器 [英] window.open with popup blocker

查看:125
本文介绍了window.open与弹出式窗口拦截器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从我的默认页面打开某个页面。
所有在默认页面中的代码是:

 < script type =text / javascript> ; 
window.open(StartPage.aspx,,fullscreen = yes);
< / script>

问题在于浏览器的弹出窗口阻止程序阻止了这一点,我需要允许浏览器打开它。
我想避免这种情况,并且每个使用我的Web应用程序的人都不需要允许弹出窗口阻止程序打开页面。我想通过弹出式窗口拦截器并在未经许可的情况下打开页面。


有没有办法做到这一点?
谢谢

解决方案

adamantium是对的。如果弹出窗口阻止程序可能被导致弹出窗口的代码覆盖,那么它将毫无用处。您可以做的最好的是:

 < script type =text / javascript> 
var myPopup = window.open(StartPage.aspx,,fullscreen = yes);
if(!myPopup)
alert('弹出窗口被阻止,请在弹出窗口阻止程序中为此网站设置例外并重试');
< / script>


I am trying to open a certain page from my default page. All the code there is in the default page is:

<script type="text/javascript">
        window.open("StartPage.aspx", "", "fullscreen=yes");  
</script>

The problem is that the browser's popup blocker blocks this and I need allow the browser to open it. I want to avoid this and that every one that will use my web application won't need to allow the popup blocker to open the page. I want to pass the popup blocker and open the page without permission.

Is there a way to do so? Thanks

解决方案

adamantium is right. a popup blocker would be pretty useless if it could be overridden by the code that's causing the popup. the best you can do is this:

<script type="text/javascript">
    var myPopup = window.open("StartPage.aspx", "", "fullscreen=yes");  
    if(!myPopup)
        alert('a popup was blocked. please make an exception for this site in your popup blocker and try again');
</script>

这篇关于window.open与弹出式窗口拦截器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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