Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Avene/5221ed5a088de75a8ad9 to your computer and use it in GitHub Desktop.
Save Avene/5221ed5a088de75a8ad9 to your computer and use it in GitHub Desktop.
Android WebView にJavascriptのイベントハンドラを追加する ref: http://qiita.com/Avene/items/dee2ee3eca6151e66c3b
@InjectView(R.id.profile_registration_webView)
WebView mWebView;
mWebView.setWebViewClient(new WebViewClient() {
@Override
public void onPageFinished(WebView view, String url) {
                 // url to filter target page
if (url.startsWith("http://target/page/url")) {
                //something to do in javascript
view.loadUrl("javascript:$('#target_element_id').keydown( function () {" +
"  $('html, body').animate({ scrollTop: 10000}, 300);" +
               "} );");
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment