Skip to main content
September 23, 2015
Question

StageWebView & localStorage

  • September 23, 2015
  • 0 replies
  • 317 views

[as]

var www:StageWebView = new StageWebView();

// line below won't compile

//www.engine = StageWebViewEngine.WEBKIT_ENGINE;

www.stage = this.stage;

www.viewPort = new Rectangle (0, 0, 600, 600);

var source:File = File.applicationDirectory.resolvePath("htmls");//copy entire folder (with css)

var destination:File = File.applicationStorageDirectory; 

source.copyTo(destination, true);//copy to the application storage 

//get path to the html page within copied folder 

var resultsPageUrl:String = "file://" + destination.resolvePath("manage.html").nativePath; 

www.loadURL(resultsPageUrl); 

[/as]

manage.html (snip):

[js]

myStorage = localStorage;


localStorage.setItem('myCat', 'Tom');

[/js]

I end up with these run-time errors

TypeError: Result of expression 'this.get.bind' [undefined] is not a function.

&

ReferenceError: Can't find variable: localStorage

Does anyone know how to use localStorage in javascript from StageWebView on all devices?

Window.localStorage - Web APIs | MDN

This topic has been closed for replies.