Ido Ran
Ido Ran

Reputation: 11384

Adobe AIR StageWebView fail to show web page with javascript

I'm trying to write a mobile app using Adobe AIR which shows a web page.
I just want to show the web page and allow the user to browse it.

The problem is when I try to do it I'm getting lots of Javascript errors and the page is partially rendered but in an unreadable way.

I've tried to pass true to the useNative ctor parameter but it didn't seem to make any difference.

Is there a way to display HTML content from the web in Adobe AIR without using ANE?

Upvotes: 0

Views: 648

Answers (1)

Koby Douek
Koby Douek

Reputation: 16675

You don't need an ANE to allow users to browse a web page with Adobe AIR. Using a webView is the best, simple, popular way.

webView.stage = this.stage;
webView.viewPort = new Rectangle(0, 0, stage.stageWidth, stage.stageHeight);
webView.loadURL("http://www.example.com");

Your problem is not the ActionScript code you developed. It's the page that your are loading into your webView element. If the page has Javascript errors with your webView, it probably has Javascript errors using a simple browser on your mobile device (or even on a desktop). Thus, passing True to useNative will not solve your problem.

To solve this problem, run the app in debug mode and look for the Javascript errors in the debug console. For me, for example, the Javascript command console.log function was unrecognized by the webView and broke many parts of my Javascript execution in my pages. Go through each of the Javascript errors appearing and fix them, until your page runs smoothly.

Upvotes: 1

Related Questions