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
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
Share Improve this question asked Nov 24, 2009 at 13:23 AnatAnat 1432 silver badges8 bronze badges 2- 3 If you could bypass a popup blocker, don't you think all the ad spam would be doing it? – skaffman Commented Nov 24, 2009 at 13:52
- 1 If you could bypass the popup blocker, it wouldn't be a popup blocker. – NickFitz Commented Nov 24, 2009 at 15:17
6 Answers
Reset to default 13adamantium 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>
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.
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. You can try submitting form with target="_blank"
and action set to your url, but forefox blocked this, google chrome not.
I don't think that's impossible, everyday I see streaming pages opening popups all the time and mine's being blocked so it should be a way to bypass it
You have to fire the function from an user event such as onclick().
const anchorElement = document.querySelector('a');
anchorElement.addEventListener('click', () => {
window.open("StartPage.aspx", "", "fullscreen=yes");
});