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?
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.
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: www.mywebsite.com, the WebLink then believes the URL is: http://127.0.0.1:8080/www.mywebsite.com. Needless to say, that don’t work. (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.