I'm trying to load an url with webview. My url is http://my-hit.com/ahmet-kaya/2 . It is not loading because url changing to http://my-hit.com/ahmet-kaya2 while loading. I have controlled the url in on pagefinished function ; the "/" character falls. I tried %2F instead of "/" but did not work. Please help me.
myurl = http://my-hit.com/ahmet-kaya;
String mynewurl;
CurrentPage = CurrentPage + 1;
//Integer.valueOf(CurrentPage).toString();
mynewurl = myurl +"/"+ CurrentPage;
mProgress = new ProgressDialog(MainActivty.this);
mProgress.setMessage("Yükleniyor...");
mProgress.setCancelable(false);
mProgress.show();
final boolean loadingFinished = true;
web.setWebViewClient(new WebViewClient() {
@Override
public void onPageFinished(WebView view, String url)
{
/* This call inject JavaScript into the page which just finished loading. */
view.loadUrl("javascript:window.HTMLOUT.showHTML('<head>'+document.getElementsByTagName('html')[0].innerHTML+'</head>');");
view.clearCache(true);
}
});
/* load a web page */
web.loadUrl(mynewurl);
you need to enable javascript in settings for the webview. Try using this code:
WebSettings settings = web.getSettings();
settings.setJavaScriptEnabled(true);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.