找不到网页错误 [英] web page not available error

查看:142
本文介绍了找不到网页错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 私有类HelloWebViewClient扩展WebViewClient {
    @覆盖

    公共布尔shouldOverrideUrlLoading(web视图查看,字符串URL){
        view.loadUrl(URL);
    返回true;
    }
}

的WebView W =(web视图)dialog.findViewById(R.id.webView);
WebView.enablePlatformNotifications();
w.getSettings()setJavaScriptEnabled(真)。
瓦特。的getSettings()setJavaScriptCanOpenWindowsAutomatically(假);
瓦特的getSettings()setPluginsEnabled(真)。
w.loadUrl(http://www.agaraadhi.com);
w.setWebViewClient(新HelloWebViewClient());
 

我试图加载一个网页到网络view.I得到的网页无法error.I可以从默认browser.I设置权限在manifest.But以下code ++工程,访问页面精细。

 开放的URI = Uri.parse(http://www.agaraadhi.com);
意向意图=新的意图(Intent.ACTION_VIEW,URI);
startActivity(意向);
 

解决方案

你有权限 android.permission.INTERNET对在AndroidManifest.xml中启用?例如,

 <使用-权限的Andr​​oid:名称=android.permission.INTERNET对/>
 


对于上面的评论之一,我没有听说过要求 ACCESS_NETWORK_STATE 许可WebViews的,并让他们没有工作,但也许是功能,将自动使用对于一些可选的,如果可用(?)

private class HelloWebViewClient extends WebViewClient {
    @Override

    public boolean shouldOverrideUrlLoading(WebView view, String url) {
        view.loadUrl(url);
    return true;
    }
}

WebView w=(WebView) dialog.findViewById(R.id.webView);
WebView.enablePlatformNotifications();
w.getSettings().setJavaScriptEnabled(true); 
w. getSettings().setJavaScriptCanOpenWindowsAutomatically (false);
w. getSettings().setPluginsEnabled (true);
w.loadUrl("http://www.agaraadhi.com");
w.setWebViewClient(new HelloWebViewClient());

I'm trying to load a web page into the web view.I get web page not available error.I can access the page from the default browser.I set the permission in manifest.But the below code works fine.

Uri uri = Uri.parse("http://www.agaraadhi.com");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);

解决方案

Do you have the permission android.permission.INTERNET enabled in AndroidManifest.xml? E.g.

<uses-permission android:name="android.permission.INTERNET"/>


Regarding one of the comments above, I haven't heard of WebViews requiring the ACCESS_NETWORK_STATE permission, and have had them working without it, but perhaps the functionality is automatically used for something optional if available(?)

这篇关于找不到网页错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆