Skip to main content
Inspiring
May 25, 2019
Question

[WINDOWS10] StageWebView, LocationEvent.CHANGING not fired if link is called in JavaScript.

  • May 25, 2019
  • 1 reply
  • 401 views

Hello there,

StageWebView (non native) on windows.

If link is called tapping on

<a href="...">link</a>

LocationEvent.CHANGING is called thus can be intercepted with preventDefault();

If a link is called with:

window.location = "...";

The LocationEvent.CHANGING is not fired.

Works well on iOS and Android.

Bug still exists on AIR 32.0.0.129

This topic has been closed for replies.

1 reply

Inspiring
May 25, 2019

providing some code maybe?

PippoApps  wrote


If a link is called with:

window.location = "...";

The LocationEvent.CHANGING is not fired.

so many things ...

why use JS to change the window.location in the first place?

because without JS and just listening to the LocationEvent it should just work fine
so you decided to use JS, why ?

do you use loadURL() or loadString() ?

is it a local file? do you access it with file:// ? is it a custom scheme?

is there some special characters in the URL?

if it is a local file where do you store it?
what is the JS that change the location?
did you try other things like document.location, document.location.href ?

see

Adobe Flash Platform * Displaying HTML content in mobile apps

the part about loading content from local or remote resource


see

StageWebView differences between platforms | AIR SDK

for slight different behaviour of the stagewebview implementation

PippoAppsAuthor
Inspiring
May 25, 2019

Thank you Zwetan.

I will try some of the workarounds you suggest.

I use JavaScript because what happens in WebViews is quite complex, and I need to send several messages to ActionScripts (that you can intercept only with Locationevent.CHANGING).

Other than the architactural choice for which I do have my reasons, thank you for the links I will try to look if there is more info.