To Catch a Popup Blocker

Obviously, when you try to open a new tab and the user has their popup blocker engaged, they get a javascript error message.

Is there a way to catch the javascript error so that a polite dialog can tell the user their popup blocker is turned on?

You shouldn’t be getting a Javascript error though. The browser should just shut down the new window request.

How are you popping up a new window/tab ?

at is the standard JavaScript way of opening a new window. I suppose if there is a popup blocker, you never get the name of the new window.

That said, I would abstain to do what you describe. Unless you absolutely need a new tab open, better stick to solutions like a palette, which the user can close if he needs to.

Don’t forget that most modern browsers prevent popups by default, and personally I would really mind having to go into settings to change that. I would probably simply click out of the site and abandon.

Lastly, there is a way that will work even with a popupblocker engaged : use a weblink with the option to open in a new window. Since this is an action initiated by the user, it will open just very nicely.

I suppose you already know that you won’t be able to display a webpage from the current session, because even if you point to your app, it will be a new session.

I was passing ‘thisURL’ to this method, which works if popup blockers aren’t enabled.

jvScript = "var'" + thisURL +"', '_blank');win.focus();"

However, I just took your advice and sent the embed code from a youtube video to an html viewer and it worked just perfect, so I will use that in a dialog to prevent it!


Browsers consider Javascript as a popup if it’s not the direct result of a click.

Unfortunately with Xojo Web’s round-trip system, you will never be able to use ExecuteJavascript with a because it will never be a direct response to a click.