PURA VIDA example "How does the property Webviewer.WebViewString work?" does not work properly

I have downloaded the .aia file of the example(App Inventor Code Snippets | Pura Vida Apps) , and when I use the blocks as they are in .aia
block1
I get a message


But if I use "http://localhost/webviewstring.html" it works perfectly

why does this happen?
What is the difference between using one or the other call?

Things have moved on since that guide was written, as you have found. No real need to test for "development" with this example, just use http://localhost/~ when testing with companion app or with a compiled app.

Can I send .img, or .txt files to //localhost when the app is compiled?

http://localhost/~ is for reading files from the assets to the webviewer. That is its only function. Assets are read-only.

I understand. But what I want to send a new file to the webviewer that doesn't exist in assets before compiling

Nothing can be added to Assets after compiling. If your App is creating an HTML file, save it in the App's ASD. If you are downloading an HTML file, you can save that in the ASD too using an extension:

... or download to the /Download shared folder on your Smartphone.

Thanks.
I'll try it.

It helps to read the snippet completely...

Note: You now can use the following path, which works for development and production!

http://localhost/webviewstring.html

Note: see also the following tutorial by ABG.

Taifun

->It helps to read the snippet completely...
Perhaps the problem is keeping an example in a "tutorial" that no longer works?

It may actually still be pertinent for early version Android, and if used correctly still works. I have not had the time to check below Android 8.

Maintaining a website while providing technical support (free, we are volunteers) to people around the world is no easy task - there are just not enough hours in a day.

Taifun is one of the foremost experts in App Inventor - we are lucky to have his code snippets and extensions.

1 Like

Both should work for the WebViewer with the compiled app:

grafik

I think you are doing a great job.
You respond quickly and accurately to all the questions we ask you.
It was by no means my intention to criticize your work.

Back to my initial question, what I am trying to open in the webviewer is a .gpx file, not html. The html is already in assets.
I will now try with DownloadToASD.aix
I will let you know the results.
Thanks

4 posts were split to a new topic: Open gpx file in webviewer with run javascript