Welcome Guest Search | Active Topics | Sign In | Register

TargetUrl is blank in NewWindow Event Options
tblas
Posted: Friday, January 5, 2018 2:47:23 PM
Rank: Newbie
Groups: Member

Joined: 1/5/2018
Posts: 2
I am having some issues accessing the TargetUrl in the NewWindow event. I do not want to use the WebView that was created. Rather, I want to handle it myself by launching a browser outside of the windows application. This seems simple enough, but I'm finding that TargetUrl is sometimes blank inside of the NewWindow event. This doesn't happen in all cases.

In my case, if I open http://www.epicor.com in an EO WebBrowser, and then click any of the social media links (linkedin, facebook, etc) in the top right corner, the TargetUrl in the NewWindow event is blank. I see that the facebook link is launched with this html: <a href="https://www.facebook.com/epicor" target="_blank">, which seems standard.

Is this expected behavior? Are there specific ways that a new window is launched that would cause this to happen? I've been able to get things working by opening a new popup window and using the WebView that was created, but I'd rather avoid this behavior.

We are at version 17.0.95.0. Thanks for any guidance.
eo_support
Posted: Friday, January 5, 2018 6:45:45 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,221
Hi,

This can occur when the new window is opened with JavaScript. Consider the following JavaScript code:

Code: JavaScript
//Open a new window with blank Url
var newWindow = window.open("", "new_window");

//Now set the target Url
newWindow.location.href = targetUrl;


NewWindow event is fired for the first line. Since indeed blank Url has been passed to window.open, you will see the blank Url in NewWindow event.

In the page you provided, they used gtm.js (Google Tag Manager) and code in this JavaScript file seems to have handle all link click event with the above JavaScript code. There will be no easy way for you to intercept the new Url in this case.

Thanks!
tblas
Posted: Friday, January 5, 2018 6:52:14 PM
Rank: Newbie
Groups: Member

Joined: 1/5/2018
Posts: 2
Ok thank you. I was guessing it was something like that.

Unfortunately for our app, it can be any web page at all opened in the EO Browser (specified by user), so we have no control over how those internal links work. I will continue with opening a popup window using the WebView in the case that no TargetUrl exists.

Thanks for the information.
eo_support
Posted: Friday, January 5, 2018 6:54:41 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,221
You are very welcome. Please feel free to let us know if you still have any other questions.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.