# \[Solved\] Get Javascript value within webviewer?

**URL:** <https://community.thunkable.com/t/solved-get-javascript-value-within-webviewer/1956416>\
**Category:** Questions about Thunkable X\
**Tags:** webviewer, solved, javascript\
**Created:** [July 7, 2022, 8:05pm UTC](https://community.thunkable.com/t/solved-get-javascript-value-within-webviewer/1956416 "2022-07-07T20:05:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![thomas.lorentzonsi](https://avatars.discourse-cdn.com/v4/letter/t/aeb1de/32.png) [@thomas.lorentzonsi](https://community.thunkable.com/u/thomas.lorentzonsi)\
**Post date:** [July 7, 2022, 8:05pm UTC](https://community.thunkable.com/t/solved-get-javascript-value-within-webviewer/1956416/1 "2022-07-07T20:05:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [July 7, 2022, 8:45pm UTC](https://community.thunkable.com/t/solved-get-javascript-value-within-webviewer/1956416/2 "2022-07-07T20:45:32Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![thomas.lorentzonsi](https://avatars.discourse-cdn.com/v4/letter/t/aeb1de/32.png) [@thomas.lorentzonsi](https://community.thunkable.com/u/thomas.lorentzonsi)\
**Post date:** [July 17, 2022, 7:19pm UTC](https://community.thunkable.com/t/solved-get-javascript-value-within-webviewer/1956416/3 "2022-07-17T19:19:36Z")

</div>

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?

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/e/4/e4cfba068174b47112a4b2f80a7f5f34f06b1668.png)

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [July 18, 2022, 3:10pm UTC](https://community.thunkable.com/t/solved-get-javascript-value-within-webviewer/1956416/4 "2022-07-18T15:10:10Z")

</div>

> [@thomas.lorentzonsi](#):
>
> Is it possible to devide the html code and javascript code like below

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.

---

<div class="post-metadata">

**Author:** ![thomas.lorentzonsi](https://avatars.discourse-cdn.com/v4/letter/t/aeb1de/32.png) [@thomas.lorentzonsi](https://community.thunkable.com/u/thomas.lorentzonsi)\
**Post date:** [July 23, 2022, 5:56pm UTC](https://community.thunkable.com/t/solved-get-javascript-value-within-webviewer/1956416/5 "2022-07-23T17:56:41Z")

</div>

I have solved this on my own.

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

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/e/4e417a463d9d165599c14cacf016d642d01ac556.png)

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

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

ThunkableWebviewerExtension.postMessage(yourvalue);

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/f/0f59f292712368bce16ff80133ae10de8a6f27e8.png) [@system](https://community.thunkable.com/u/system)\
**Post date:** [October 21, 2022, 5:57pm UTC](https://community.thunkable.com/t/solved-get-javascript-value-within-webviewer/1956416/6 "2022-10-21T17:57:23Z")

</div>

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