iPhone html 应用程序 - 跨站点 xmlhttprequest?
在 iPhone 上,您可以在网页上添加收藏夹,如果该网页具有适用于 iPhone 的正确元标记,它会获得一个图标,甚至可以“隐藏”浏览器镶边并像应用程序一样显示。使用 html5 http 标头,您甚至可以让手机完全缓存“应用程序”,这样它就不必再次联系服务器。
我遇到的问题是我想编写向服务器发出 xmlhttprequests 的应用程序,该服务器不是它们最初来自的服务器。我听说如果您以某种方式导出您的收藏夹和 HTML5 chache,然后手动编辑导出文件以更改收藏夹的 URL,然后再次导入它们,这样手机就不会认为 javascript 正在尝试跨站点,就可以做到这一点xmlhttp请求。
但是我还没有发现类似的东西(也许这是越狱的事情?)。目前我必须在“应用程序”最初来自的服务器上有一个代理,这显然非常烦人。
我还听说有一个特殊的元标记,允许您为 xmlhttprequest 指定另一个域,它与指定该页面实际上是一个镜像有关,并且应该将其视为来自另一个域。有谁知道这是什么元标签?我尝试在苹果上搜索所有内容,但一无所获。
我相信如果你能让 webkit 将缓存视为 file:// 协议,这也是可能的,因为这样跨站点安全性将不适用。
On an iphone, you can add a favourite when on a webpage and if that webpage has the correct meta tags for iphone, it gets an icon and can even 'hide' the browsers chrome and display just like an App. With html5 http headers you can even have the phone completely cache the 'app' so that it never has to contact the server again.
The problem I have is that I want to write apps that make xmlhttprequests to a server that is not the server they were originally from. I heard its possible to do this if you somehow export your favourites and HTML5 chache then manually edit the export file to change the URL for the favourite, then import them again, so that the phone doesn't think the javascript is trying a cross site xmlhttprequest.
However I have not found anything like that (maybe it was a jailbreak thing?). At the moment I have to have a proxy on the server where the 'app' originally came from, which is obviously very annoying.
I also heard that there was a special meta tag that allowed you to specify one other domain for xmlhttprequest, it had something to do with specifying that the page was actually a mirror and should be treated as if it came from another domain. Does anyone know what meta tag this is? I tried searching all over apple and found nothing.
I believe it might also be possible if you can get webkit to treat the cache as a file:// protocal, because then cross site security will not apply.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
答案是这是不可能的,也不意味着是可能的。
The answer is this is not possible and is not meant to be possible.