Today my friend shows me allaboutrajni.com. Its awesome site. You can’t enter into the site until you disconnect the internet. Cool like Rajnikant. I Just eager to know how does this work. Lets explore.

At first I thought it was using offline storage. Downloading all data -> Store in cache and by some tweak (maybe javascipt), it disable the ‘Enter Site’ option. After disconnecting internet connection it displays data from local storage. Opened inspect element in chrome -> Resources. But there is nothing in local storage. I was partially correct but not satisfactory. Lets more look into it.

Opened the source code. The page is loaded a flash file (http://allaboutrajni.com/Design.swf). Wow! Another flash site!

Downloaded the flash file. Decompiled it with Flash Decompiler (used flare) and got the actionscript code. Scrolled a little bit, in 2209 line no got the function checkInternet(). Bingo got the funda… Lets see the function.

var t = setInterval(traceMessage, 1000);

In every 1000 milisecons (1 sec) it calls traceMessage function.

function traceMessage() {
checkInternet();
}

From that function checkInternet function called.

In checkInternet function it tries to load some XML file from internet (With passing some random variable. Seems trying to avoid caching – I guess, not sure). If it responds (success == true) that means internet connection is there.

If it got internet connection response, then it behaves according to logic.

if (page != 'Landing') {
 CheckBtn.gotoAndStop(4);
 jokshome._visible = false;
} else {
 trace(2);
 jokshome._visible = true;
 LandingPage.gotoAndStop(1);
 CheckBtn.gotoAndStop(1);
}

-> If it is landing page then jokeshome part is visible (else part). Seems jokeshome is block with the message ‘It runs on Rajni Power! The only way to enter the website is by switching off the internet.

RunsOnRajniPower

if (page != 'Landing' && errorPopupOpen == false) {
displayPopup(OffInternetError, OffInternetError.ErrorBg, OffInternetError.ErrorMsg, true);
OffInternetError.ErrorMsg.gotoAndPlay(2);</pre>
errorPopupOpen = true;
 preloaderP = true;
 }

-> If Its not a landing page and popUp is not opened (means you visited some portion of the site and then connect the internet) it will show popup stating ‘Aiyyo That was unexpected. To keep browsing switch off your internet’.

Aiyyo

If you disconnect the internet (or make the browser offline mode) jokshome._visible = false; and you can see the ‘Click Here to Enter Website Button’

Congratulation

What ever simple logic it is, hats off to the person from whom this idea comes. Awesome implementation and design.

You can check the decoded checkInternet() function. Its self explanatory.

function checkInternet() {
 var v2 = random(999999999999.0);
 var v1 = new XML();
 v1.load('http://www.allaboutrajni.com/config.xml?' + v2);
 v1.onLoad = function (success) {
 if (success) {
 sharebts.gotoAndStop(1);
 if (page != 'Landing') {
 CheckBtn.gotoAndStop(4);
 jokshome._visible = false;
 } else {
 trace(2);
 jokshome._visible = true;
 LandingPage.gotoAndStop(1);
 CheckBtn.gotoAndStop(1);
 }
 if (page != 'Landing' && errorPopupOpen == false) {
 displayPopup(OffInternetError, OffInternetError.ErrorBg, OffInternetError.ErrorMsg, true);
 OffInternetError.ErrorMsg.gotoAndPlay(2);
 errorPopupOpen = true;
 preloaderP = true;
 }
 trace('loaded');
 } else {
 trace('not loaded');
 sharebts.gotoAndStop(2);
 jokshome._visible = false;
 trace(2);
 preloaderP = false;
 if (CheckBtn._currentframe == 1) {
 CheckBtn.gotoAndStop(3);
 LandingPage.gotoAndStop(2);
 }
 if (CheckBtn._currentframe == 4) {
 CheckBtn.gotoAndStop(3);
 }
 if (errorPopupOpen == true) {
 OffInternetError.ErrorMsg.gotoAndPlay('closepopup');
 errorPopupOpen = false;
 }
 if (howtoPopup == true) {
 HowTo.HowToMsg.Howto.gotoAndPlay('END');
 howtoPopup = false;
 }
 }
 };

}

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.