Webviewerstring

On the side of the html, should i poll the get webviewerstring with a timer or is there any event firing to know that the string has changed, like it happens on the side of the blocks?

Did you even look ? :wink:

component_event

Hello TIMAI2,
:slight_smile: yes i saw it.
I was speaking about something like this but for the HTML.

Ahh, you can use the setInteval event with javascript to do this:

https://www.w3schools.com/jsref/met_win_setinterval.asp

Yes as I told I’m using a timer. I was wandering if there was a proper way to do it.
So do you mean there is not another way?

This is one way to do it when you want the javascript to keep checking for a change in an an element. You could try using an eventListener(), but why not try some web searching yourself?

You are right to ask this, but believe me, when i come here it’s because i was not able to find a solution by myself. Probably i searched for the wrong thing, in fact I was looking for an example about webstring and I didn’t find too much.
I’m sure eventListener will help. I will go deeper, I’m not expert of Html.
Thank you

As I told, i don’t know much about html or JS so, hoping in my luck, i tried something like:

window.AppInventor.getWebViewString().addEventListener(‘change’, functionX);
or
document.AppInventor.getWebViewString().onchange = function () {functionX()};
with many variation that my fantasy suggested, but unsuccessfully.

What is the correct syntax?

I do not know, really not sure if it will work. The page has to refresh in some way to capture the new webviewstring. This can be done with a setInterval call. I have not found another way, this works…

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