dimanche 3 mai 2015

Get return value from Javascript in Android

I want to get a return value from a JavaScript function that will be run after the URL changes (after login).

I followed this link. However I never get to onJsAlert method.

This is my javascript code:

if (typeof document.getElementById('infoContainer') !== 'undefined') {
document.getElementById('infoContainer')
.getElementsByClassName('gamerStat')[0].getElementsByTagName('a')[0].innerHTML }

If I put this code in:

webView.loadUrl("javascript:alert(my_code)");

I get error: uncaught syntaxerror: unexpected token if...

If you need additional info feel free to ask.

Aucun commentaire:

Enregistrer un commentaire