Javascript Cordova inappbrowser Devicerady从不开火
我有一个cordova项目,我需要使用inappbrowser插件打开一个窗口,其中包含cordova页面,而“父级”仍在运行 Cordova加载Javascript Cordova inappbrowser Devicerady从不开火,javascript,cordova,Javascript,Cordova,我有一个cordova项目,我需要使用inappbrowser插件打开一个窗口,其中包含cordova页面,而“父级”仍在运行 Cordova加载index.html,使用InApp浏览器插件打开frame.html。 Cordova get已加载到frame.html中,但deviceready事件从未触发,5秒钟后,我在frame.html的控制台中收到此错误 这只发生在使用inappbrowser插件打开的第二个webview中 错误: 我搜索了很多,得出的结论是,延迟启动devicere
index.html
,使用InApp浏览器插件打开frame.html
。Cordova get已加载到
frame.html
中,但deviceready事件从未触发,5秒钟后,我在frame.html
的控制台中收到此错误
这只发生在使用inappbrowser插件打开的第二个webview中
错误:
我搜索了很多,得出的结论是,延迟启动deviceready所需的onNativeReady事件的不是文档加载中的插件或代码过多。当我删除
cordova插件文件
和cordova插件文件传输
时,onFileSystemsReady
错误消失。
如果我删除cordova插件设备
,则onCordovaInfoReady
错误消失
但我需要这些插件。是什么导致DeviceRady事件根本不触发?
在不删除所需插件的情况下,如何启动它? 项目信息:
节点版本:v4.2.2
Cordova版本:5.4.1
已安装的平台:
安卓4.1.1
ios 3.9.2
已安装的插件:
cordova插件bluetoothle 2.4.0“Bluetooth LE”
cordova插件设备1.1.0“设备”
cordova插件对话框1.2.0“通知”
cordova插件文件3.0.0“文件”
cordova插件文件传输1.4.0“文件传输”
cordova插件inappbrowser 1.1.0“inappbrowser”
cordova插件振动2.0.0“振动”
cordova插件白名单1.2.0“白名单”
de.appplant.cordova.plugin.background-mode 0.6.4“BackgroundMode”
Config.xml文件:
特斯塔普
响应deviceready事件的Apache Cordova应用程序示例。
编辑:
我需要使用inappbrowser插件,因为蓝牙插件在另一个框架中浏览应用程序时必须保持连接。
框架还需要能够相互通信,并且两者都可以访问cordova库
如果有人有其他想法怎么做,我愿意接受
更新:
我正在研究cl.kunder.webview插件@ThisNameBetterBeAvailable
不向客户提供Cordova服务
我引述文件(第3段)
InAppBrowser窗口的行为类似于标准web浏览器,无法访问Cordova API
这意味着没有插件,没有事件,也没有服务。我试图让他们修复文档的这一部分,但这需要一段时间
您可以在这里看到:首次加载index.html时,“deviceready”将只调用一次。如果您想使用InApp Browser加载事件,我想您需要使用InApp Browser事件,如“loadstart、loadstop、loaderror、exit”。不确定这是否是您想要的解决方案,但据我所知,这正是您想要的。@JDev cordova记录有2个频道尚未启动。如果我删除使用这两个通道的插件,deviceready将启动。我希望它在安装插件的情况下启动。这两个插件还没有完成加载,否则deviceready会被烧掉,我想自己添加这些CordovaAPI太难了吧?或者分叉并添加cordova API是可能的?我以前使用的A似乎能够访问cordova API,只是我无法在创建的webview和启动它的webview之间进行任何通信。感谢插件上的指针。截至目前,Cordova插件代理库中有13个插件;许多是一个或两个基源的克隆。我试着保持一个关于“官方”图书馆、它们的和的博客的运行。科尔多瓦插件的一个常见替代品是HTML5API。根据平台的不同,您可以访问GPS(地理定位)、摄像头、本地存储等。在你的问题上,如果你的目标仅仅是蓝牙,你应该重新考虑你的设计,并可能使用SPA(单页应用程序)或类似的东西。考虑到替代方案,添加是很困难的。您可以随时使用fork,并将其用作私有插件。然而,你所指的插件与当前所有“安全性”变化背道而驰;谷歌、苹果或Phonegap都不允许这样做。从网站上获取网页被认为是危险的,并且会在网页和应用程序之间建立一条线。要使用Cordova/Phonegap,您需要添加白名单。此白名单工作表应该会有所帮助。祝你好运
cordova.js:1183 deviceready has not fired after 5 seconds.
cordova.js:1176 Channel not fired: onFileSystemPathsReady
cordova.js:1176 Channel not fired: onCordovaInfoReady
Node version: v4.2.2
Cordova version: 5.4.1
Installed platforms:
android 4.1.1
ios 3.9.2
Installed plugins:
cordova-plugin-bluetoothle 2.4.0 "Bluetooth LE"
cordova-plugin-device 1.1.0 "Device"
cordova-plugin-dialogs 1.2.0 "Notification"
cordova-plugin-file 3.0.0 "File"
cordova-plugin-file-transfer 1.4.0 "File Transfer"
cordova-plugin-inappbrowser 1.1.0 "InAppBrowser"
cordova-plugin-vibration 2.0.0 "Vibration"
cordova-plugin-whitelist 1.2.0 "Whitelist"
de.appplant.cordova.plugin.background-mode 0.6.4 "BackgroundMode"
Config.xml file:
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.test.app" version="0.0.1" xmlns="http://www.w3.org/ns/widgets">
<name>TestApp</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="dev@cordova.apache.org" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="index.html" />
<plugin name="cordova-plugin-whitelist" spec="1" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<allow-navigation href="http://*/*" />
<platform name="android">
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
</widget>
<!DOCTYPE html>
<html >
<head >
<meta http-equiv="Content-Security-Policy" content="default-src * data: gap: https://ssl.gstatic.com 'unsafe-eval' 'unsafe-inline';" >
<meta name="format-detection" content="telephone=no" >
<meta name="msapplication-tap-highlight" content="no" >
<meta name="viewport" content="user-scalable=no, initial-scale=1, height=device-height, width=device-width" >
<title >Index</title >
<script >
document.addEventListener( 'deviceready', function ()
{
console.log( 'ready' );
win = window.open( 'frame.html', '_blank', 'location=no', function()
{
console.log( arguments );
} );
}, false );
</script >
</head >
<body >
<script type="text/javascript" src="cordova.js" ></script >
</body >
</html >
<!DOCTYPE html>
<html >
<head >
<meta http-equiv="Content-Security-Policy" content="default-src * data: gap: https://ssl.gstatic.com 'unsafe-eval' 'unsafe-inline';" >
<meta name="format-detection" content="telephone=no" >
<meta name="msapplication-tap-highlight" content="no" >
<meta name="viewport" content="user-scalable=no, initial-scale=1, height=device-height, width=device-width" >
<title >Frame</title >
<script >
window.addEventListener( 'deviceready', function()
{
console.log( 'window.deviceready', arguments );
}, false );
document.addEventListener( 'deviceready', function()
{
console.log( 'document.deviceready', arguments );
}, false );
</script >
</head >
<body >
<script type="text/javascript" src="cordova.js" ></script >
</body >
</html >