1

With JavaScript, HTML and CSS and maybe PhoneGap (optional), how do you create and run a simple html page directly from LocalStorage? I basically want a custom HTML page that I can view online through my ipod the first time, and when I go offline with my touch, I can still access the same source and interact with the page as though I still have internet. I can't find any guides on how to build this project.

Thanks for any pointers or direction to sources that teach this!

2 Answers 2

3

localStorage is very limited, especially in size, and isn't dedicated to this.

To make your site available offline, you need to use the new HTML5 application cache.

Here's a very good tutorial : http://www.html5rocks.com/en/tutorials/appcache/beginner/

An excerpt from the introduction :

It's becoming increasingly important for web-based applications to be accessible offline. Yes, all browsers have caching mechanisms, but they're unreliable and don't always work as you might expect. HTML5 addresses some of the annoyances of being offline with the ApplicationCache interface.

Sign up to request clarification or add additional context in comments.

5 Comments

@CMKanode +1 diveintohtml5 is a pleasant and very recommendable read, at least for an introduction.
Awesome so far, but What if I don't have permission to modify an Apache server to add AddType text/cache-manifest .manifest, is there away to do that indirectly via javascript??? I'm basically in a SharePoint Designer environment.
A well managed server should already have this type. If not, you can always add it in a .htaccess file in the directory of your site.
Regarding your question about SharePoint : all http servers handle the parameterization of mime types, even SharePoint, so this isn't a problem.
Thank you - This is where I will begin my journey!
1

You may actually be looking for ApplicationCache. AppCache allows you to specify to the OS what files it should hold on to in memory. Think of localStorage and sessionStorage as offline variables of sorts, while AppCache is the director that tells the device what resources to hold in local memory for later offline browsing.

1 Comment

Yes, an ApplicationCache is what I want, but I can't add an add AddType text/cache-manifest .manifest. I'm in a SharePoint environment, not an Apache/PHP location.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.