开发者

Track clicks in webview Android

开发者 https://www.devze.com 2023-04-02 06:00 出处:网络
I have been facing with a serious issue since weeks! I want to track all the clicks done in a Android webview. I know, the solution is implementing WebViewClient, but that doesn\'t track the clicks do

I have been facing with a serious issue since weeks! I want to track all the clicks done in a Android webview. I know, the solution is implementing WebViewClient, but that doesn't track the clicks done in frames!

Example -

When you open a website within google translate, webviewclient doesn't track click开发者_运维问答s made in the translated page!

Secondly, even when using Android 3.0, when i open google.com, it shows Google instant i think, and i am unable to track that url!

I'll be very very thankful if you can help me with this.

Thanks Nithin


If it is your own Web content, you should track this in JavaScript.

If it is not your own Web content, it's conceivable you could cook up some general-purpose JavaScript for this and apply it via loadUrl("javascript:...") and addJavascriptInterface(), but I wouldn't know the details, as I'm not a low-level JS+DOM expert.

WebViewClient itself does not handle all scenarios, as you note, and it is the only pure Java solution I know of.

0

精彩评论

暂无评论...
验证码 换一张
取 消