开发者

iPad Fullscreen Mode && Airplane Mode

开发者 https://www.devze.com 2023-04-04 22:42 出处:网络
I\'m in the process of developing an iPad web app that needs to be in Fullscreen mode and Airplane mode at the same time.

I'm in the process of developing an iPad web app that needs to be in Fullscreen mode and Airplane mode at the same time.

We've been using the Cache Manifest to store all the files we need but the tricky part is that right now we're passing information in the URL ie. file.html?account=234 and when you try to link to a file like this during Airplane mode an error is returned saying that the iPad can't access the domain... despite the fact that file.html is cached in the Cache Manifest.

It seems like the iPad thinks that file.html and file.html?account=234 are two completely different files/URLs, so then it sees that it's not in the Cache Manifest and tries to connect to the server.

The idea behind all of this is that we display a list of accounts in index.html from a JSON file and then in file.html (we get the account param with the jQuery $.url().param() plug-in) and build the account info from the JSON file.

It's like a lo-fi way of using the JSON file as a Database, and it works fine in Fullscreen Mode.. unless you're in Airplane Mode. And that's a problem because this prototype needs to work without in开发者_JAVA百科ternet connections.

It seems like my approach is completely wrong, but I'm sort of at a loss now. Is there a way to use AJAX to load the file.html into the index.html and at the same time pass along account=234?


file.html?account=234 and file.html are 2 different urls. You could add the account number in the hash(#) instead of as a parameter. But I think it would be nicer if you just stored the account number in a cookie or localstorage.


Ok so I'm happy to report that localStorage was the perfect solution. I just stored a key/value as "account","234".


Safari, like all browsers, will not cache URLs with a querystring. This fact is used all the time to force AJAX calls to be refreshed by adding a querystring.

At the simplest level, try switching to use component parts of the URL instead - like /account-234/.

Or as you said, your approach may simply not make sense. Have you looked at using HTML5 local storage? You can pull down all the relevant information into a data structure that makes sense for you and store it for offline usage.

0

精彩评论

暂无评论...
验证码 换一张
取 消