I'm trying to automatically redirect from a local html file in an android web-view to a browser window when a cookie is read. The JavaScript below opens the URL in the web-view but I need it to open in a separate browser instead.
onload=function(){
document.getElementById('linksNewWindow').checked = readCookie('linksNewWindow')==1? true : false;
if(document.getElementById('linksNewWindow').checked = readCookie('linksNewWindow')== true){
location.href = "url";
}
}
The code for the android app just calls the local html file into the webview
if (android.os.Build.VERSION.RELEASE.startsWith("4.4.2")) {
String localUrl = "file:///android_asset/splash/splashKitkat.html";
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl(localUrl);
}
I'm not sure if this is a small issue with my javascript or something bigger if someone could help me out that would be great. Thanks in advance