I have a app
that only contains a webview
. It shows a page (mine) that has a textarea. I want to be able to inject some code lines javascript
to modify that element when I click on the "back" key. Here I show what I have so far (which unfortunately does not work):
@Override
public boolean onKeyDown(int keyCode, KeyEvent event){
if(keyCode == KeyEvent.KEYCODE_BACK){
mWebview.loadUrl("javascript:(getElementsByTagName('textarea').style.background='blue')");
}
return super.onKeyDown(keyCode, event);
}
It only works if I put:
"javascript:(alert('Se activó el alert');)"
But nothing more. Is it possible to access, by means of js local
, an element html externo
and modify it?