[Solved] Get Javascript value within webviewer?

Hi,

I have a asset file that contains html and javascript.Is it possible to get a javascript value (const) from the file when pressing a button?

//T

1 Like

You can work with HTML and JavaScript using a URL but when the code is part of the project assets it will work using the computer but not using the mobile app.

Ok thanks for the reply. Is it possible to devide the html code and javascript code like below, and then fetch the javascript result with block logic?

1 Like

No, this arrangement will not work. You need to create your HTML and JS script in a location where you can reach it as URL.

1 Like

I have solved this on my own.

If you would like to get result from javascript you use the following block;

image

And then you add the following code in your .html file;

script src=“https://thunkable.github.io/webviewer-extension/thunkableWebviewerExtension.js” type=“text/javascript”></script

ThunkableWebviewerExtension.postMessage(yourvalue);

2 Likes

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