开发者

Intercept html button click

is there any possibility to intercept when a user cli开发者_StackOverflow中文版cks on a html button? I ve an webviewclient that load a login page with two buttons. Allow and Deny. I would you like to intercept when the deny button is pressed. (Deny and allow have the same basUrl and a js do the correct redirect).

thanks in advance


You are probably not getting a callback to shouldOverrideUrlLoading() because that is only called if the user triggers the navigation - if you use jquery/javascript or some other kind of redirect, then it will not be called.

If you are in control of the web page, you can add can a JavaScriptInterface to call back to your Android app an handle it however you like here: http://developer.android.com/guide/webapps/webview.html#BindingJavaScript

With JSI you simply register a function in your app and then call it in the page's javascript.

If you are not in control of the website, you can still inject the javascript yourself if you are familiar with the structure/DOM of the web page.


Sounds like a case for implementing WebViewClient.shouldOverrideUrlLoading(), surely?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜