How to Detect Click on Web Viewer?

Is there any way to Detect Link Click on Web Viewer?

Unfortunately no.

1 Like

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:
http://appinventor.mit.edu/explore/ai2/webview-javascript.html

A basic snippet by Pura Vida Apps (Taifun):
http://puravidaapps.com/snippets.php#2webviewstring

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

Thanks
I want to detect clicks on third party website links.
can you please explain more how to inject WebViewString setter code to onclick and href for all website elements with Executing JavaScript.

I can write a tutorial today about that.

3 Likes

So sorry about that :frowning_face: Because of my school and other jobs, I can’t find time for that. But I will make soon.

2 Likes

Can you now explain me how to do so.
That would be very Helpful.

This page has been saved in my browser for 7 days waiting for the answer on how to use the

:joy: :joy: :joy: :joy: