Live data from Hacker News

You shouldn't hotlink someone else's JavaScript

beta.whatispolymath.com

21–30 of 102 posts

Re: You shouldn't hotlink someone else's JavaScript

#22
post #15
post #5

Ok there is a better way to handle this than adding some html to a page to make a banner, posting to HN, and hoping for the best. Check for referal headers and throw a 301.

Well, I see it as a great reminder why one shouldn't trust scripts hosted elsewhere into one's site.

Indeed, it's the funniest public sevice announcement I have seen in a while.

Re: You shouldn't hotlink someone else's JavaScript

#23
post #5

Ok there is a better way to handle this than adding some html to a page to make a banner, posting to HN, and hoping for the best. Check for referal headers and throw a 301.

But if you do that you have to configure your server for it, and your server still has to handle the request. The file is 2KB gzipped; Serving the file or a redirection is basically the same thing.

Re: You shouldn't hotlink someone else's JavaScript

#26
post #23
post #5

Ok there is a better way to handle this than adding some html to a page to make a banner, posting to HN, and hoping for the best. Check for referal headers and throw a 301.

But if you do that you have to configure your server for it, and your server still has to handle the request. The file is 2KB gzipped; Serving the file or a redirection is basically the same thing.

Maybe it would be better to reply with 403 instead?

Re: You shouldn't hotlink someone else's JavaScript

#28
post #18
post #8

Earlier quoted context omitted.

I hope referrals will be disabled anytime soon. Firefox has AFAIK disable referrals to other domains by default.

In the case of Javascript hotlinking, that'll do approximately diddly squat though. if(/whatispolymath/.exec(location.href)) alert("...");

That is a way better, IMO.

Re: You shouldn't hotlink someone else's JavaScript

#29

And that's a pretty mild example of what could happen if you did. Hotlinking javascript is an excellent way to allow someone else to pull all kinds of tricks with your visitors and your image. For example, redirecting all your traffic to a shocksite. Every time you include some externally hosted javascript you open yourself and your visitors to a security risk. And on top of that, if you do it like this you're steali…

The standard pattern is never use external dependencies directly, but to keep copies and host them on your CDN.

That way, you can run them through the ol' asset pipeline too... minifiers and possibly serve them straight from gzips.

Gotta always remind ppl of https://developers.google.com/speed/ ... the OP scores 47 (out of 100)

Re: You shouldn't hotlink someone else's JavaScript

#30
a friend asked me some days ago: can u help me with a little problem? my old coder has no time to fix it.

the classic: "it worked yesterday..."

so i checked the code and all js,css files where used from a git repo from some other guy. who moved all files away in other directories.

was easy to fix, but i have no idea how stupid his coder is to use github urls from other people repos!!

Post reply on HN