简体   繁体   中英

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 = (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:

 <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?).

Thank you in advance!

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

You have a space encoded character %20 in your URL...

use a valid url like:

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

Alternatively you can also try 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.

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.

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