Today help a friend to do an apk, the content is all done with HTML5, and then the whole folder (including JS, CS, image, etc.) all a brain plug into the assets directory, and then in the code through WebView call Loadurl ("file:///android _asset/xxx.html "), JS support is also added, settings.setjavascriptenabled (true), originally uttered run up a little problem, the results reported a comparison of the egg pain, error content is cannot Read property ' Giftdoctoruserinfo ' of NULL, see it directly:
2. Solution Solutions
At that time also do not know what reason, search giftdoctoruserinfo this word, found that JS inside, I think is not and DOM related, there is no basis, on-line search answers, StackOverflow and other search data have been checked, the last kung Fu, Finally in the webview problem found the desired answer, the solution is very simple, just add the code settings.setdomstorageenabled (TRUE);
It's done, attached to the solution:
Look at the effect is good oh, is not a kind of local application of bright, in fact, is HTML5 write, it seems HTML5 is the future trend ah, a set of code, a variety of smart devices running, a bit far away. Finally, I hope to help the people who need it! Thank you!
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Android-Error Summary one: WebView load local JS