【问题标题】:Android WebView page not available - " com.fidelier.printfromweb "Android WebView 页面不可用 - “com.fidelier.printfromweb”
【发布时间】:2015-08-26 14:13:09
【问题描述】:

我有一个应该显示www.mysitename.com 的基本WebView 应用程序。虽然可以通过内置浏览器和WebView访问该网站, 当我在 WebView 中调用链接时,我唯一遇到的问题(当我接近纸流浏览器时,一切都很好)

<a onclick = "" href = "com.fidelier.printfromweb: // $ biguhw $ Print From Web intro $ $$ small $ Print small letter $ intro intro $$ $$ $$ intro cut $" data-role = "button" data-inline = "true"> Test print from web </a>

(https://play.google.com/store/apps/details?id=com.fidelier.posprinterdriver)

我保证:
1. 允许上网的uses-permission标签是manifest标签的子标签。
2. 为 WebView 启用 javascript。

【问题讨论】:

  • 你能重新定义你的问题吗?如果在 WebView 中调用链接会发生什么?有链接还是只有一个特殊链接?
  • 当调用链接

标签: php android html webview


【解决方案1】:

这是一个解决方案,问题正在打开 外部链接

 @Override
            public boolean shouldOverrideUrlLoading(final WebView view, final String url){
                if(url.contains("com.fidelier.printfromweb:")){
                    Uri uri = Uri.parse(url);
                    Intent intent = new Intent(Intent.ACTION_VIEW, uri);
                    startActivity(intent);
                    return true; //the webview will not load the URL
                } else {
                    return false; //the webview will handle it
                }
            }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多