远程服务cordova应用程序www文件夹 [英] serving cordova app www folder remotely

查看:184
本文介绍了远程服务cordova应用程序www文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人知道如何远程服务phonegap / cordova应用程序的www文件夹?



所以我开发这个相机应用程序使用sencha触摸框架与一层科尔多瓦获得访问设备本机相机。



我试图远程提供www文件夹,以便无需更新应用程序即可将更新推送给用户。



所以我试图只是将www文件夹从Android平台复制到远程服务器。这工作在Android,但所有其他设备无法加载网站。



当我在ios上测试时,我得到一个显示gap_init:2的JS警告



编辑:事实证明,Android是缓存的旧网站。

解决方案



这可以通过使用

  window.document.location = http:// yoursite.com 

从Phonegap应用程式




  1. 使用Sencha CMD构建您的远程应用程序需要几个步骤才能允许Phonegap API函数从您的远程应用程序运行。

  2. 在您的服务器上部署构建文件。

  3. 将适当平台iOS,Android等的cordova.js文件复制到远程服务器部署

  4. 如果您使用Cordova 3.0或更高版本,还需要将任何插件JavaScript文件复制到您的远程服务器。

  5. 您的远程应用程序index.html文件cordova.js。脚本链接应在Sencha微加载程序代码之前。

正确配置。您的Phonegap应用程序将加载远程Web应用程序,运行cordova.js脚本,然后启动Sencha应用程序代码。您可以从您的远程应用程序代码访问Phonegap设备API。



我使用此方法与Sencha Touch 2.3.1和Phonegap 3.5



您还可以配置应用缓存以允许远程服务的应用离线使用


Does anyone know how to serve the phonegap/cordova app www folder remotely?

So i'm developing this camera app using the sencha touch framework with a layer of cordova to gain access to devices native camera.

Im trying to serve the www folder remotely to be able to push updates to users without having to update the app.

So i have tried to just copy the www folder from the android platform to the remote server. This worked on android but all other devices failed to load the website. Is the www folder specific to the device?

When i test on ios i get a JS alert displaying "gap_init:2"

EDIT: As it turns out, android was caching the old website. Now i'm down to nothing working.

Any help would be appriciated.

解决方案

This can be done by simply loading the remote site using

window.document.location = http://yoursite.com

from the Phonegap app

There are a few more steps required to allow the Phonegap API functions to work from your remote app.

  1. Build your remote app using Sencha CMD
  2. Deploy the build files on your server.
  3. Copy the cordova.js file for the proper platform iOS, Android etc. to your remote server deployment folder.
  4. If your using Cordova 3.0 or higher you will also need to copy any plugin JavaScript files to your remote server
  5. Add a script link in your remote app index.html file for cordova.js. The script link should occur before the Sencha microloader code.

When this is configured properly. Your Phonegap app will load the remote web app, run the cordova.js script then launch the Sencha app code. You will have access to the Phonegap device API from your remote app code.

I have used this approach with Sencha Touch 2.3.1 and Phonegap 3.5

You can also configure the appcache to allow your remotely served app to be available 'offline'

这篇关于远程服务cordova应用程序www文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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