Last active
August 29, 2015 14:09
-
-
Save Avene/5221ed5a088de75a8ad9 to your computer and use it in GitHub Desktop.
Android WebView にJavascriptのイベントハンドラを追加する ref: http://qiita.com/Avene/items/dee2ee3eca6151e66c3b
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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