Webview Hide Div not working

Hello everyone.

I trying to develop a app, with a webview.
All goes well, except if i try to hide an element (DIV) in the HTML code.

When testing by QR code it hides and show the DIV. But when build the apk, it does not work don´t hide, always show everything.
document.getElementById(“MenuUm”).style.display = “none”;
document.getElementById(“MenuDois”).style.display = “block”;

Any ideia??

Thanks.

Don’t know why it wouldn’t work. You have to realize that a webviewer is not a full browser. So there may be situations that some things just won’t work. If that is the cause with you i don’t know. You should give some more info on you htmlcode. Show it here or make a aia-file that contains the code.

1 Like

Hi. There is a sample of the code:

..............

This code, when “body loads” execute the function that should hide some DIVS. It works when testing (by QR code), but when build apk and run it on the same phone, does not work.

Thanks.

You should be able to run javascript. Is the run javascript option set to true in the component?

Yeah the javascript is active.

It really seems it does not work the javascript. There is also the “desktop mode” does it changes anything? I did not try it…

Also tryed to put the script block in the header, is the same.

I think the KEY problem her is tha in TEST works all fine, and in build APK an run on phone, not.

Thanks.

Hell.

Problem solved, after soma hours searching the WEB.

You need to substitute the path from test mode to production mode:

file:///mnt/sdcard/AppInventor/assets/.html

file:///android_asset/.html

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.