WebStageView local HTML path in Android

I am trying to load local HTML (which exists in the project folder structure) in an instance of webStageView. Although this works fine in windows and ipad / iphone - it does not find files in Android (only tried in 2.2)

File.applicationDirectory.url returns "app:" File.applicationStorageDirectory.url returns "app-storage:"

File.applicationDirectory.nativePath returns an empty string as specified in the Adobe documentation.

The problem is that the webview gives the error message "Webpage is not available, application: /test/index.html not found." Is there a way to get the full path or "make" the browser understand that the application: refers to a specific folder?

Thank!

+5
source share
2 answers

As Adobe help reports :

Applications: and storage application: schemes are not supported.

On iOS, your code works fine, but on Android you have to achieve this with some hacker implementation like yours because there are security issues related to loading StateWebView URLs from these directories. Another solution is to copy your application: or the storage application: the file to a temporary one and load this temporary file into StageWebView:

var htmlFile:File = File.applicationDirectory.resolvePath(url);
var workingFile:File = File.createTempFile();
htmlFile.copyTo(workingFile, true);
stageWebView.loadURL(workingFile.url);

: , html- .as StageWebView.loadString(). , Android.

0

. : URL- . : schem; . , :///~User/2ndFile.html. ; URL- , URL-. ; ~ : URL. :///home/User/2ndFile.html( Unix), :///Users/User/2ndFile.html( Mac OS X) :///C:///2ndFile.html( Windows). .

0

All Articles