How to Detect Click on Web Viewer?

Think again :grin:

Yes, there is a way to detect click on Web Viewer with WebViewString feature.

If you change WebViewString value in your website with JavaScript, it will trigger App Inventor app, and you can do any actions you want, and also you can get/set WebViewString data.

It is a very useful feature sharing data between App Inventor app and website.

For example this code sets the WebViewString to “Hi”.

window.AppInventor.setWebViewString("Hi!");

If you own the website

When you put this JavaScript code in your website, you can get this value in App Inventor app and in your website too.

More details from MIT App Inventor website:

A basic snippet by Pura Vida Apps (Taifun):

But if you are trying to detect someone’s website click

You can inject WebViewString setter code to onclick and href for all website elements with Executing JavaScript.

3 Likes