Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
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?
Posted

1 solution

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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900