jQuery Mobile - 使用 PhoneGap 和 WP7.5 加载页面时出错 - 安全问题? [英] jQuery Mobile - error loading pages using PhoneGap and WP7.5 - issue with security?

查看:16
本文介绍了jQuery Mobile - 使用 PhoneGap 和 WP7.5 加载页面时出错 - 安全问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用 android phonegap 1.2 和 jqm 1.0 运行良好的应用程序,我正在尝试将它移植到 Windows Phone 7.5.

I have an app that runs fine using android phonegap 1.2 and jqm 1.0, and I'm attempting to port it to windows phone 7.5.

当 index.html 页面加载时,首先要做的是使用 $.mobile.loadpage 加载另一个 html 页面.我在 wp7.5 应用程序上得到的只是短暂闪烁的错误加载页面"消息.如果我在 index.html 上的页面上放了一个 href,我会得到同样的错误.总结:

When the index.html page loads, the first thing is does is use a $.mobile.loadpage to load another html page. all i get on the wp7.5 app is the 'error loading page' message flash up briefly. if i put an href to the page on index.html i get the same error. to summarise:

  • 在桌面浏览器中运行 index.html 有效
  • 在 android 上运行该应用程序
  • 在 wp7.5 上运行该应用程序而无需调用其他页面
  • ie (wp7.5) 中的 jqm 可以加载其他页面
  • 如果我从应用程序中链接到公共 jqm 站点,则该公共站点将正常工作(即 jqm 将加载位于 www 上的页面)
  • 我已经将 $.support.cors = true; 放在 js 代码中以启用跨站点 xhr 请求
  • running the index.html in a desktop browser works
  • running the app on android works
  • running the app on wp7.5 without calling another page works
  • jqm in ie (on wp7.5) can load other pages
  • if i link to a public jqm site from within the app, the public site works (ie jqm will load pages that are located on the www)
  • i have put $.support.cors = true; in the js code to enable cross site xhr requests

在我看来,唯一的问题是 jqm 尝试通过 ajax 加载本地文件.我认为这与 phonegap 使用的网络浏览器控件中的默认安全设置有关?

it seems to me that the only issue is when jqm tries to load a local file via ajax. i assume this has something to do with default security settings in the webbrowser control that phonegap uses?

任何人都可以对此有所了解吗?

can anyone shed any light on this?

推荐答案

我怀疑这是 WP7 坚持从本地网站"加载的所有页面实际上都是从隔离存储加载的.

I suspect this is WP7's insistence that all pages loaded from the "local website" are actually loaded from IsolatedStorage.

在较新的 Phonegap/Cordova WP7 项目模板中,每个构建都会维护一个文件 CordovaSourceDictionary.xml,它将为您执行此操作.只需确保您希望能够导航到/加载的任何文件(是的,您也必须对图像执行此操作)在您的项目中具有内容"的构建操作,并且在构建它时,此 xml 将被更新自动.

In the newer Phonegap / Cordova WP7 project templates there is a file maintained per build, CordovaSourceDictionary.xml which will do this for you. Just make sure that whatever files you want to be able to navigate to / load (yes, you have to do it for images too) have a Build Actiion of "Content" in your project and when you build it, this xml will be updated automatically.

当您的应用程序运行时,Cordova 在 WP7 上做的第一件事就是检查这个 XML 文件中的所有文件,并将它们复制到isolatedStorage,以便它们可以被加载/导航到.

When your app runs the first thing Cordova does on WP7 is go through all the files in this XML file and copy them to isolatedStorage so they can be loaded / navigated to.

这篇关于jQuery Mobile - 使用 PhoneGap 和 WP7.5 加载页面时出错 - 安全问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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