这是我的webview我收到的错误就像你的浏览器不兼容
对于我的Url它说目前,iClient支持Chrome,Safari,Firefox和IE 10 +
这是我的Webview
public class MyWebV extends AppCompatActivity {
private WebView webView;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.web_data);
TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
Iid = telephonyManager.getDeviceId();
did = Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID);
SharedPreferences s = getSharedPreferences(MyWebV_SP, 0);
HashMap<String, String> map= (HashMap<String, String>) s.getAll();
webView = (WebView) findViewById(R.id.web5);
WebSettings set = webView.getSettings();
webView.setWebViewClient(new WebViewClient());
webView.setWebChromeClient(new WebChromeClient());
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
set.setJavaScriptEnabled(true);
webView.getSettings().setLoadWithOverviewMode(true);
webView.getSettings().setUseWideViewPort(true);
set.setJavaScriptCanOpenWindowsAutomatically(true);
webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
final AlertDialog alertDialog = new AlertDialog.Builder(this).create();
final ProgressDialog progressBar = ProgressDialog.show(MyWebV.this, "Please Wait", "Loading...");
webView.requestFocusFromTouch();
webView.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url) {
String summary = "<html><body style='background:#fff;'><br><div ><b><p style='color: black;font-size:20px;text-align:left;'>Unable to load information.</p></b><div style='color: black;text-align:center;'>Please check if your Network connection.</div><br><div> <p style='color: black;text-align:center;'>Or<br><br> <div style='color: black;text-align:center;'>Server May be Temporarily Down\n" + "\n" +
"<div style='color: black;text-align:center;'>Please Try After Sometime</p></div></div></div></div></body></html>";
view.loadData(summary, "text/html", null);
view.loadUrl(url);
return true;
}
public void onLoadResource (WebView view, String url) {
if (progressBar == null) {
progressBar.setTitle("Please Wait !");
progressBar.setMessage("Loading...");
progressBar.show();
}
}
public void onPageFinished(WebView view, String url) {
try{
if (progressBar.isShowing()) {
progressBar.dismiss();
}
}catch(Exception exception){
exception.printStackTrace();
}
}
@SuppressWarnings("deprecation")
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
String summary = "<html><body style='background:#fff;'><br><div ><b><p style='color: black;font-size:20px;text-align:left;'>Unable to load information.</p></b><div style='color: black;text-align:center;'>Please check your Network Connection.</div><br><div> <p style='color: black;text-align:center;'>Or<br><div style='color: black;text-align:center;'>Server May be Temporarily Down\n" + "\n" +
"<div style='color: black;text-align:center;'>Please Try After Sometime</p></div></div></div></div></body></html>";
view.loadData(summary, "text/html", null);
alertDialog.setTitle("Error");
alertDialog.setMessage(description);
alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
return;
}
});
alertDialog.show();
}
});
webView.setWebChromeClient(new WebChromeClient());
String url = "https://iclientsimulator.test.tyro.com/configuration.html#landing";
System.out.println(url);
try{
if(URLUtil.isValidUrl(url)) {
webView.loadUrl(url);
}
else{
String e = "<html><body style='background:#fff;'><br><div ><b><p style='color: black;font-size:20px;text-align:left;'>Please Exit app and Open it After setup.</p></b></div></div></body></html>";
}
}
catch (Exception e) {
String summary = "<html><body style='background:#fff;'><br><div ><b><p style='color: black;font-size:20px;text-align:left;'>Unable to load information.</p></b><div style='color: black;text-align:center;'>Server May be Temporarily Down\n" + "\n" +
"<div style='color: black;text-align:center;'>Please Try After Sometime</p></div></div></body></html>";
}
}
@Override
protected void onSaveInstanceState(Bundle outState){
super.onSaveInstanceState(outState);
webView.saveState(outState);
}
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
webView.restoreState(savedInstanceState);
}
@Override
public void onConfigurationChanged(Configuration newConfig){
super.onConfigurationChanged(newConfig);
}
private void startWebView(String url) {
webView.setWebViewClient(new WebViewClient() {
ProgressDialog progressDialog;
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
public void onLoadResource (WebView view, String url) {
if (progressDialog == null) {
progressDialog = new ProgressDialog(MyWebV.this);
progressDialog.setMessage("Loading...");
progressDialog.show();
}
}
public void onPageFinished(WebView view, String url) {
try{
if (progressDialog.isShowing()) {
progressDialog.dismiss();
progressDialog = null;
}
}catch(Exception exception){
exception.printStackTrace();
}
}
});
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl(url);
}
@Override
public void onBackPressed() {
if(webView.canGoBack()) {
webView.goBack();
} else {
super.onBackPressed();
}
}
}
我在这里使用WebChromeClient
但是我收到的错误表示您浏览器不兼容的网址
这是我想在网络视图中找到的网址https://iclient.tyro.com/configuration.html#landing ...
如何在任何移动浏览器上加载不仅是Chrome默认浏览器......任何人都可以建议我它只是我的网络视图的一部分来确认那个tyro的设备....