Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does this site (allaboutrajni) works only when you go offline? (disconnect from internet)

The following site only works if you are offline. Link

So how do they do this?

I have even seen Youtube do something similar. just open YouTube and disconnect net and refresh. You will see the page below.

enter image description here

like image 409
aWebDeveloper Avatar asked Apr 02 '12 12:04

aWebDeveloper


1 Answers

HTML5 allows webpages to work offline by;

  1. Providing storage in terms of localStorage and sessionStorage.
  2. Providing events to let the page know when it's online/ offline
  3. The navigation.onLine property is a boolean which lets you know whether you're online or not.
  4. Giving application caches.

So basically, both pages store the assets it needs to work offline in either of those storage mediums, and checks whether it's online or offline when the page loads.

For more info, you could see http://www.html5rocks.com/en/features/offline

EDIT: Meh, infact the site you linked to works by downloading the flash content, and then pinging http://images.desimartini.com/allaboutrajni/config.xml every second to detect whether it's still connected to the internet. This website won't load if you disconnect and then refresh the page.

However, a page which uses true offline functionality is one such as http://htmlfive.appspot.com/static/stickies.html

like image 170
Matt Avatar answered Nov 19 '22 12:11

Matt