我在配置文件中设置:
<access origin="*" subdomains="true" />
<access origin=".*" subdomains="true" />
<content src="http://mydomain.pl/aps_mobile/" />但是在http://mydomain.pl/aps_mobile/上不执行事件"deviceready“,并且navigator.camera是未定义的。我哪里做错了?
发布于 2013-05-21 08:05:05
如果您从外部主机执行cordova脚本,则无法访问硬件资源,因为该脚本没有映射到Phonegap应用程序的libs/cordova.x.jar。但是你可以这样解决:
在res/xml/config.xml中
<access origin="*" />
<content src="index.html" />在assets/www/index.html中
<body>
<script type="text/javascript" src="cordova-x.x.x.js"></script>
<iframe name="framewrap" id="framewrap"
style="border:0;position: absolute; top: 0; left: 0;width: 100%;"
src="http://yourwebsite.pl">
</iframe>
<script type="text/javascript">
document.getElementById("framewrap").contentWindow.navigator = navigator;
</script>
</body>最后,在摄像头配置中,如果你想要DATA_URL,你必须将destinationType设置为0,如果你想要FILE_URI,你必须设置1,如果你想要NATIVE_URI,你必须设置2。
我希望能帮助你
发布于 2013-04-18 00:07:54
索引文件不应在服务器上。您需要在应用程序的assets文件夹中拥有一个index.html,并通过jquery ajax调用建立到服务器的连接。还要确保您已经在index.html中导入了cordova和phonegap javascript文件
https://stackoverflow.com/questions/16064142
复制相似问题