PhoneGap的/网页转换为手机使用 [英] Phonegap / Converting website for mobile use

查看:215
本文介绍了PhoneGap的/网页转换为手机使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我建立使用的PhoneGap为Android和iOS系统的应用程序。从本质上讲,这将是一个网站,但我遇到了我,由于需要通过AJAX(同源策略)以进行跨域请求一些困难。我想知道,如果它能够更好地做我自己的服务器上的网站,在那里PHP是允许的,然后用包装/帧PhoneGap的模仿网站?如何将这项工作?

Currently I am building an app using phonegap for the Android and iOS systems. Essentially, it will be a website but I am running into some difficulties due the cross domain requests I need to make via ajax (same origin policy). Im wondering if its better to make the website on my own servers, where PHP is allowed, and then use a wrapper/frame in phonegap to emulate the site? How would that work?

帮助AP preciated

Help appreciated

推荐答案

您不应该在所有有这个问题。 PhoneGap的应用程序加载该设备作为本地文件上://页面和跨域安全政策并不适用于他们。

You shouldn't be having this problem at all. PhoneGap apps are loaded on the device as local file:// pages, and the cross-domain security policy does not apply to them.

从PhoneGap的常见问题:

From the PhoneGap FAQ:

Q值。我想创建的PhoneGap通过AJAX访问外部部署的Web服务的应用程序。我该如何解决与问题
  XmlHtt prequest的跨域安全策略?

Q. I want to create an application for phonegap to access externally deployed web services via AJAX. How can i resolve the issue with the cross-domain security policy of XmlHttpRequest?

一个。交叉域安全策略不影响PhoneGap的应用程序。由于HTML文件是由与文件的webkit称为://协议,安全策略并不适用。
  (在Android中,您可以通过编辑AndroidManifest.xml中授予android.permission.INTERNET对你的应用程序)

A. The cross-domain security policy does not affect PhoneGap applications. Since the html files are called by webkit with the file:// protocol, the security policy does not apply. (in Android,you may grant android.permission.INTERNET to your app by edit the AndroidManifest.xml)

这篇关于PhoneGap的/网页转换为手机使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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