Lurker News

Comments (337) 70 threads

Earlier comments
SkyLinx3 replies#
I have just added it to a Shopify store to try it and it does indeed speed things up! However I am a little concerned with adding a script from another website... it requires a lot of trust, doesn'it?
nicolashahn1 reply#
As another comment mentioned, you can just host the script on your own site.
SkyLinx#
Of course.... I was confused with the Cloudflare Workers thing... I just added the code directly to the website and it works fine. Thanks.
bacondude3#
> However I am a little concerned with adding a script from another website... it requires a lot of trust, doesn'it?

Not if you use the `integrity` attribute like the page recommends. If the file hash doesn't match the one given in the tag, the browser won't run the script.
https://developer.mozilla.org/en-US/docs/Web/Security/Subres...

dwheeler#
You can download the code to your own site, and serve it from there. It has an MIT license, and is on GitHub.
amelius#
This should be implemented at the browser level, not in a webpage.
joepour#
This is awesome! Added it to all the public pages of https://tinytracker.co - thank you, @dieulot :)
neillyons1 reply#
This is really impressive! I noticed the script uses `const` and `let` which might cause javascript errors in older browsers (https://caniuse.com/#search=let) so I ran it through the Google Closure compiler to compile it down to ES3 and it works great. https://closure-compiler.appspot.com/home

I've added it to my blog and a Django side project. Really speeds up page loads. Just need to add `data-no-instant` attribute to the logout link.

dieulot1 reply#
It’s loaded as a module so older browsers won’t execute it (and thus won’t choke on the modern syntax).
neillyons#
Oh. Interesting. I didn't know about modules.

Load more comments