You need to know that window.open has a return value, and that value may be null if the action failed. The _blank bit helps for the mailto redirection to work on mobile, btw.Īs a good practice I think it is a good idea to test if a popup was blocked and take action in case. I actually use this solution for a mailto redirection, and it works on all my browsers (windows 7, Android). Go to the Privacy tab, and under Pop-up Blocker, select the Turn on Pop-up Blocker check box, and then tap or click ok. Click the tools button (it is in the top righthand corner and looks like a cog), then select internet options. Examples:Ī) An external HTML page: replace the above line with var importantStuff = window.open('', '_blank') ī) Text: add the following line below the above one: ('Loading preview.') įill it with content when ready (when the AJAX call is returned, for instance) = '' Īlternatively, you could close the window here if you don't need it after all ( if ajax request fails, for example - thanks to for the comment): importantStuff.close() Here’s how to stop pop ups appearing when browsing with IE (Internet Explorer). Optional: add some "waiting" info message. (Enrich the call to window.open with whatever additional options you need.) Immediately create a blank popup on user action var importantStuff = window.open('', '_blank') Based on Jason Sebring's very useful tip, and on the stuff covered here and there, I found a perfect solution for my case:
0 Comments
Leave a Reply. |