views-widgets-samples
views-widgets-samples copied to clipboard
Something wrong in the Webview's navigation
Hi, I'm using the Webview in my App, I added the useragent in the websettings, but the second page can not goback to the first page using webview.goback(). By the way, it gose well with no customizing useragent. As the codes showing below:
String userAgentString = webSettings.getUserAgentString();
webSettings.setUserAgentString(userAgentString.concat(myAgent));
webSettings.setJavaScriptEnabled(true);
webSettings.setAllowUniversalAccessFromFileURLs(true);
webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
webSettings.setDomStorageEnabled(true);
@Override
public void onBackPressed() {
if (!webview.canGoBack()) {
super.onBackPressed();
}else{
webview.back();
}
}