html5离线网络应用 [英] html5 offline web app

查看:116
本文介绍了html5离线网络应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人遇到过这个问题吗?

我有一个HTML5离线Web应用程序,该应用程序是为Mobile Safari创建的,可链接到SQL Server数据库.该应用程序使用缓存清单脱机工作,并且运行良好且没有问题.
与服务器数据库的同步使用JSON文件,该JSON文件通过同一站点中的ONLINE asp.net页(在缓存清单中声明为NETWORK资源)传递给服务器. asp.net页使用DevExpress aspxCallback控件将文件作为e.parameter传递到服务器,然后将要由javascript处理的e.result返回到本地数据库.

由于文件相对较小(200-400k),所有文件都可以正常工作,并且可以正常工作.

然后,我将Web应用程序保存到iPhone或iPad上的主屏幕,将其打开,然后继续按设计运行.除非在将来的某个随机时刻,同步将拒绝工作.该代码将创建JSON文件并调用不会触发的aspxCallback控件.没有什么.没有错误,它只是停止工作.

如果不保存到主屏幕,它就可以在Safari和Mobile Safari上运行,但是一旦保存到主屏幕,则仅在回调之前无法工作.

Hi, Has anyone met this issue?

I have an HTML5 off line web app, created for Mobile Safari that links to an SQL Server database. The app works off line using a cache manifest and works well and without issues.
The sync to the server database uses a JSON file passes to the server via an ONLINE asp.net page within the same site (declared as a NETWORK resource within the cache manifest). The asp.net page used a DevExpress aspxCallback control to pass the file to the server as an e.parameter, and then return the e.result to be process by javascript and into the local database.

All works well and it does the job since the files are relatively small (200 - 400k).

Then I save the web app to the homescreen on the iPhone or iPad, open it and it continues to behave as designed. Except, at some random point in the future, the sync will refuse to work. The code will create the JSON file and call the aspxCallback control which will not fire. Nothing. There are no errors, it just stops working.

It works on Safari, Mobile safari if not saved to the Homescreen, but once saved to the homescreen its only a matter of time before the callback refuses to work.

Any Ideas please?

推荐答案

好吧,我讨厌让事情没有答案,所以这就是我的发现.

我认为Devexpress组件基于AJAX是正确的. HTML5 IOS和AJAX中似乎存在一些问题,即保存到主屏幕的Web应用会干扰AJAX请求(尽管不是那么简单-这是我的搜索所得出的结论-基于对JQUERY博客的反馈).因此,我放弃了Dev Express组件(该组件用于测试和使用标准ASP.NET授权),并生成了一个处理JSON数据的Web服务-并使用JQUERY从该应用中触发了该Web服务.但是我遇到了相同的问题或类似的问题.似乎JQUERY倾向于错误反馈,而宁愿使用模棱两可的沉默-Web服务响应或控件中的任何错误-您几乎没有得到任何回报.向Web服务输入多个参数是一场噩梦.

所以-这就是我所做的.

我决定使用一个参数,它是JSON数据字符串本身(是数据字符串,而不是JSON对象).

在此字符串中,我添加了用户名和密码.

为此,我必须找到一种方法来用Javascript对其进行加密,然后用.net对其进行解密-谢谢Mark Cordells的博客,这是我尝试过可靠解密的众多方法中的唯一方法.顺便说一句-更改base64加密字符串,以将"+"替换为-",否则Web服务会将其更改为空格-并且当加密为零时,将获得多余的空格,无法轻易将其改回.是的,我确实知道Javascript中的加密并不安全-但是以纯文本格式发送用户名和密码的安全性要低得多.除了关键字每次同步都会更改外,整个过程都在IOS应用程序内部.

该应用程序未使用JQUERY-无法使它正常工作-但我确实启动了XUI库-在经过FIDDLER的大量测试后-它可以正常工作.
现在,Web应用程序已在使用Phonegap的XCODE内(Phonegap非常棒).

直到Beta测试为止,绝对不是QED.
Well I hate leaving things unanswered, so here is what I discovered.

I think I am right that Devexpress components are AJAX based. There seems to be some issue in HTML5 IOS and AJAX, whereby web apps saved to the homescreen interfer with AJAX request (although it is not that simple - that is the conclusions my search revealed - based on feedback to the JQUERY blogs). So I abandoned the Dev Express component (that was for testing and using standard ASP.NET Authorisation) and generated a webservice to handle the JSON data - and used JQUERY to fire the webservice from the app. But I ran into the same - or a similar issue. It seems that JQUERY is light on error feedback prefering an enegmatic silence - any error in the webservice response or control - you get little or nothing. Feeding multiple parameters to the web service was a nightmare.

So - this is what I did.

I decided to use a single parameter, which was the JSON data string itself (yes data string not JSON object).

Inside this string I added the user name and password.

To do this I had to discover a method to encrypt them in Javascript, and Decrypt them in .net - Thank you to Mark Cordells blog which was the only one of many that I tried that decrypted reliably. By the way - change the base64 encryption string to replace the "+" with "-", otherwise the webservice will change it to a space - and when your encryption is zero padded you get extra spaces and can''t change it back easily. And yes I do know that encryption in Javascript is not secure - but sending usernames and passwords in plain text is alot less secure. Besides the keywords change with every sync, and the whole thing is inside an IOS app.

The app did not use JQUERY - could not get this to work - but I did get the XUI library to fire - and after much testing with FIDDLER - it works.
The web app is now inside XCODE using Phonegap (Phonegap is fantastic).

Up to Beta testing and definately not QED.


这篇关于html5离线网络应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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