简体   繁体   English

Android WebView无法加载网页

[英]Android webview can not load web pages

I can not load web pages using webview,Nothing is displayed, this url " http://dev.51yunche.com:7000/WeChat/Service%20introduce.html ", this is my webview 我无法使用webview加载网页,未显示任何内容,此网址为“ http://dev.51yunche.com:7000/WeChat/Service%20introduce.html ”,这是我的webview

    webView = (WebView) findViewById(R.id.drive_web);
            webView.setWebViewClient(new WebViewClient());
            webview.getSettings().setJavaScriptEnabled(true);
            webView.getSettings().setAppCacheEnabled(true);
            webView.getSettings().setDomStorageEnabled(true);//DOM Storage
        webView.loadUrl("http://dev.51yunche.com:7000/WeChat/Service%20introduce.html");

this xml: 此xml:

 <WebView
            android:id="@+id/drive_web"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            />

The console does not have any prompts or error messages。I'd like to hear some input from more experienced WebView users (and developers?). 控制台没有任何提示或错误消息。我想听听经验丰富的WebView用户(和开发人员?)的一些意见。

Thank you in advance! 先感谢您!

这不是webview问题。在Web浏览器中,该网址也显示Nothing。请检查您的html文件的后端或设计代码。

You have a space encoded character %20 in your URL... 您的网址中有一个空格编码字符%20 ...

use a valid url like: 使用有效的网址,例如:

 webView.loadUrl("http://dev.51yunche.com:7000/WeChat/Serviceintroduce.html");

Alternatively you can also try URLEncoder.encode(YOUR_URL); 另外,您也可以尝试URLEncoder.encode(YOUR_URL); function to encode the Url 编码网址的函数

Your link itself doesn't display anything in web browser. 您的链接本身在网络浏览器中不显示任何内容。 If you still have any doubt, just simply create a normal html page by yourself and run it from your local system and check it out. 如果您仍然有任何疑问,只需自己创建一个普通的html页面,然后从本地系统运行它,然后将其检出即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM