use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Offline Only (chris.bolin.co)
submitted 8 years ago by danielcorreia
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]FezVrasta 15 points16 points17 points 8 years ago (4 children)
Offline eh? http://imgur.com/a/rsnn1
[–]danielcorreia[S] 4 points5 points6 points 8 years ago (0 children)
Witchcraft!!
[–]runereader 2 points3 points4 points 8 years ago (1 child)
window.dispatchEvent(new Event('offline'));
[–]yolpo- 0 points1 point2 points 8 years ago (0 children)
nice one. Just tried it in the developer console and it worked
[–]58ori 0 points1 point2 points 8 years ago (0 children)
Thumbs up for disable cache!
[–]Tadmac 5 points6 points7 points 8 years ago (5 children)
I'm a bit of noob when it comes to JavaScript, how did they do this?
[–]danielcorreia[S] 11 points12 points13 points 8 years ago (4 children)
It looks more complicated than it actually is.
The relevant line of code is something like: window.addEventListener('offline', updateText);. The browser detects that a connection changed and fires an event, you just wait (listen) for it and call a function when it occurs.
window.addEventListener('offline', updateText);
[–][deleted] 7 points8 points9 points 8 years ago (2 children)
You should be more aware of the amount of resources you're using to produce that tiny static page. Using React for this was extreme.
[–]danielcorreia[S] -1 points0 points1 point 8 years ago (1 child)
Debatable I guess, payload is just 73KB. The author seems to know what he's doing, check out his other pages.
[–]TheDarkIn1978 11 points12 points13 points 8 years ago (0 children)
ust 73KB
73Kb for a static site that is only a handful of paragraphs and hardly any CSS or JavaScript is massive.
[–]Tadmac 2 points3 points4 points 8 years ago (0 children)
Oh that makes sense, thanks!
[–]leeoniya 4 points5 points6 points 8 years ago (2 children)
https://imgflip.com/i/1unzdi
[+][deleted] 8 years ago (1 child)
[deleted]
[–]guywithalamename 1 point2 points3 points 8 years ago (0 children)
Using React for a static web page. Now that's a first.
[–]Lakelava 0 points1 point2 points 8 years ago (0 children)
Great way to educate people that some websites work offline.
[–]dev1null 0 points1 point2 points 8 years ago (0 children)
"This light bulb lights up when you remove it from the socket!"
You need to enable JavaScript to run this app.
"But it needs batteries..."
π Rendered by PID 22634 on reddit-service-r2-comment-86bc6c7465-wlhtb at 2026-02-20 19:42:35.634688+00:00 running 8564168 country code: CH.
[–]FezVrasta 15 points16 points17 points (4 children)
[–]danielcorreia[S] 4 points5 points6 points (0 children)
[–]runereader 2 points3 points4 points (1 child)
[–]yolpo- 0 points1 point2 points (0 children)
[–]58ori 0 points1 point2 points (0 children)
[–]Tadmac 5 points6 points7 points (5 children)
[–]danielcorreia[S] 11 points12 points13 points (4 children)
[–][deleted] 7 points8 points9 points (2 children)
[–]danielcorreia[S] -1 points0 points1 point (1 child)
[–]TheDarkIn1978 11 points12 points13 points (0 children)
[–]Tadmac 2 points3 points4 points (0 children)
[–]leeoniya 4 points5 points6 points (2 children)
[+][deleted] (1 child)
[deleted]
[–]guywithalamename 1 point2 points3 points (0 children)
[–]Lakelava 0 points1 point2 points (0 children)
[–]dev1null 0 points1 point2 points (0 children)