Android Chrome:不允许加载本地资源:Chrome-native://newtab/
从Android活动中,我试图通过传递URL打开chrome。 它通常是有效的!!!! Chrome启动并显示页面 问题是“有时”,也许在我运行多次测试之后, URL没有加载,chrome甚至没有尝试,显示一个空白页面; 使用chrome for desktop进行调试:检查设备控制台中唯一的日志显示: 大宗报价 “不允许加载本地资源:chrome-native://newtab/" 我发布chrome时是这样的:Android Chrome:不允许加载本地资源:Chrome-native://newtab/,android,google-chrome,android-intent,Android,Google Chrome,Android Intent,从Android活动中,我试图通过传递URL打开chrome。 它通常是有效的!!!! Chrome启动并显示页面 问题是“有时”,也许在我运行多次测试之后, URL没有加载,chrome甚至没有尝试,显示一个空白页面; 使用chrome for desktop进行调试:检查设备控制台中唯一的日志显示: 大宗报价 “不允许加载本地资源:chrome-native://newtab/" 我发布chrome时是这样的: try { Intent i = new Intent("andr
try {
Intent i = new Intent("android.intent.action.MAIN");
i.setComponent(ComponentName.unflattenFromString("com.android.chrome/com.google.android.apps.chrome.Main"));
i.addCategory("android.intent.category.LAUNCHER");
i.setData(Uri.parse(url));
i.putExtra(Browser.EXTRA_CREATE_NEW_TAB,true);
// i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(i);
}
catch(ActivityNotFoundException e) {
// Chrome is not installed
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
i.putExtra(Browser.EXTRA_CREATE_NEW_TAB,true);
startActivity(i);
}
有任何帮助吗?请尝试以下代码:
webview.loadDataWithBaseURL(“chrome”)-native://newtab/,html,“text/html”,“utf-8”,null)代码>请参阅参考:标记不适用于移动浏览器。我没有尝试在Web视图中加载页面,我不想这样做。最新的HTML5、Javascript和WebRTC功能仅在早期版本的Chrome、Firefox或Opera上可用。这就是为什么我在intent中设置了包名“com.google.android.apps.chrome.Main”。嘿,@gaugeinvariante,你明白了吗?