简体   繁体   English

window.open with popup blocker

[英]window.open with popup blocker

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. 我想避免这种情况,并且每个使用我的Web应用程序的人都不需要允许弹出窗口阻止程序打开页面。 I want to pass the popup blocker and open the page without permission. 我想通过弹出窗口拦截器并在未经许可的情况下打开页面。

Is there a way to do so? 有办法吗? Thanks 谢谢

adamantium is right. adamantium是对的。 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>

As others have stated, you simply can't. 正如其他人所说,你根本做不到。 The browser is blocking that behavior. 浏览器阻止了这种行为。 Another option would be to not use window.open but instead use a javascript component which can give you the same behavior. 另一个选择是不使用window.open ,而是使用一个javascript组件,它可以给你相同的行为。

You won't be able to do that. 你将无法做到这一点。 Its a user preference to block pop up windows and you have no control over that. 它是一个用户首选项来阻止弹出窗口,你无法控制它。

You can open popup using onclick event only. 您只能使用onclick事件打开弹出窗口。 You can try submitting form with target="_blank" and action set to your url, but forefox blocked this, google chrome not. 您可以尝试使用target="_blank"提交表单并将操作设置为您的网址,但是forefox阻止了这一点,谷歌浏览器没有。

我不认为这是不可能的,每天我看到流媒体页面一直打开弹出窗口,我的被阻止所以它应该是一种绕过它的方法

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM