views:

127

answers:

1

Hey,

I'm got a custom webview setup which is working pretty well, but I'd like to be able to either:

1, change the url hash without the webview reloading the page (it would lose the state of my js app)

2, call some js that sits within my web page from within android. I can't change any JS within the site, unfortunately, so can't custom write any js to put on the site especially for the job, the only stuff I have control over is the Android app.

Can anyone think of a way of doing either of these?

Thanks in advance.

M

A: 

For #2, your Activity can invoke JavaScript methods. All you have to do is call the loadUrl method with the appropriate JavaScript call:

mWebView.loadUrl("javascript:wave()");

From: http://developer.android.com/resources/articles/using-webviews.html

adampax