Click here to Skip to main content
15,920,704 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
hello friends,
i work on html5 i want to know that how to use local storage in html5 and check internet connection.
My problem is that i want to store the data in local storage when internet connectivity not available and when internet connection available the data restore on sever when internet connection available. i want to use html5 for that.

thanks in advance.

1 solution

local storage in html5
Read all about them here:
HTML5 Web Storage[^]
HTML5 Local Storage – Complete Guide[^]
HTML5 localStorage – Part One[^]
HTML5 localStorage – Part Two[^]

It will help you understand on how it can be used.

how to check the internet connection available or not?
You can determine that the connection is lost by making a request to any URL using XMLHttpRequest. A failed XHR request will confirm no connection.

Though the best one is to use navigator:
    alert('You are Online');
    alert('You are Offline')

Refer: Check Network Status using HTML5 and Javascript [^]
Share this answer
niravbhavsar 17-Jul-12 3:08am    
I read this but how to check the internet connection available or not?
Sandeep Mewara 17-Jul-12 3:27am    
Answer updated.

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