I load a webpage from my assets in a webview.
Now i need to call a function to init something in the webpage.
I’ve tryed it with a html GET param:
it works on android 2.3.3 but NOT on all higher versions (webpage unavailable)
Now i a different way to solve my problem by calling a javascript function.
but the following code:
<script type="javascript">
var isChecked = "";
function initLoc(name) {
isChecked = name;
if(isChecked == null)
isChecked = "";
else
document.getElementById(isChecked).style.backgroundImage = "url(../location-button-active.png)";
}
frontWebView.loadUrl("file:///android_asset/location-front/front.html");
frontWebView.loadUrl("javascript:initLoc('"+ locationID +"')");
Gives me the following error:
06-19 11:40:07.749: E/Web Console(16210): Uncaught ReferenceError: initLoc is not defined at null:1
Does anyone knows what the problem is
I found the solution. The page wasn’t loaded so to the function wasn’t defined yet.
I call the method now in the onPageFinished and it works great.