Opening a URL in a New Browser Tab

In 2011r4.3:

In a web page I am working on, I had planned for the user to enter a URL in a WebTextField and then later be able to click a WebImage to open the URL in another tab or window in the browser.

It appears though, that the only way to open a link in another tab is via the WebLink class. If so, I am planning to replace the WebTextField with a WebLink and require the user to input the URL via a popup window (that contains a WebTextField). This solution feels “strained”, though, since the user inputs everything else into WebTextFields.

Is there any way to open a URL in another browser tab that does not utilize the WebLink class?


I wonder if you could position an empty labeled link on top of the WebImageView and get it to accept the click, open its URL in a new tab.

Couldn’t you just have a new webpage send it the URL as a string then in the Open event call ShowURL ?

Jym, Brad: I’m experimenting with both of your ideas.

Brad: Tried your idea, but it looks like the WebLink click event won’t fire unless the WebLink text property has some content. Merely assigning a URL to the URL property doesn’t do it.

Jym: The new WebPage merely replaces the existing page which is not what I want. I want the new url to appear in a new tab. I think there is a trick [something with session hashtags] to opening a WebPage in a new tab but I did not dig into that very much.

Frankly, I am rethinking my overall design strategy anyway. If I just go ahead and use a WebLink I won’t have to “fight” the framework and also I can make it very clear to the user what clicking the WebLink will do. Using a graphic to open the URL sort’ve obscures its purpose.

I’m thinking about just putting a WebLink next to the WebTextField that displays something like “[open]”.

Interesting. Not totally surprised. I’d say it’s more that your fighting web browser security than the framework. Arbitrary popup windows are a huge usability problem because of how ad spammers have taken advantage of them. So the browser will generally want the user to click something that the browser can indicate will spawn a new window.

Yes, “fighting the framework” was a poor choice of words there.

Oh I see it changed in 2011 r2 I thought it changed in 2012. Go back to r2 :slight_smile:

A little follow-up to this story: you must be careful with the URL you stick in WebLink.URL.

The framework adds localhost:8080 to the URL so if you set WebLink.URL to empty the WebLink just reloads the current WebPage. If I set WebLink.URL to something like this:, the WebLink then believes the URL is: Needless to say, that don’t work. :slight_smile: (See discussion on Feedback item 22041. )

The workaround is to make sure the URL you are assigning to WebLink.URL is prefixed with a proper http:// or https:// prefix.

Also, it looks like disabled/enabled state of the WebLink is ignored in 2011r4.3. So in my app, if no URL is necessary I have to make the WebLink invisible. Otherwise, it will stay enabled and reload the WebPage if the user clicks it.

Here is your code. But remember that the browser-preferences determine how the window is gonna show (new window, or a tab).

This function opens a new tab, and focuses it directly (to be sure it will open a new window or tab):
Plain javascript:

function open_in_new_tab(url )
  var, '_blank');

call this function like so (plain javascript):


Derk: Thanks, that’s great.

This will enable me to avoid some of the hijinks I am employing to work within the WebLink functionality.

To reliably open a new window the user must click a control with an tag that has a target of “_blank” so that the browser knows the window is user requested. Anything else will be blocked if the browser is set to block popups. In the WE framework the only control that can do this is WebLink.

I have freeware available at which allows you to add tag links to WebButtons and WebImageViews. This allows the user to open a new window by clicking a regular button or image.

Also: whether the user gets a new window or a new tab is entirely up to their browser and usually set in their preferences.

Hope this helps!

Daniel: Thanks, that’s awesome!

in case I ever come back here and try the above this one works and is simple.

ExecuteJavaScript "'','blank')"

You shouldn’t need the JavaScript: part.