4 ms·
<script src="//goo.gl/OCK7V"></script> Really?
by decklin 15y ago
<script src="//goo.gl/OCK7V"></script>
Really?
- kylek 15y agoThis irked me on a few levels too.
- Skywing 15y agoI don't understand the problem. What is wrong with the example they've given?
- tednaleid 15y agoIt's because they're using an url shortener in a non-twitter/character limited situation. Makes the browser need to go through a couple of jumps to load something that the user will want to load fast.
- alecperkins 15y agoAlso, it's bad practice to obfuscate the urls to scripts (outside of an automatic concat/compress process), especially external ones.
- jasonkostempski 15y agoIs it possible using goo.gl might get you something like a poor mans CDN? I'm thinking it may possibly respond immediately with cached results.
- mburns 15y agoNo. Regardless, a second DNS query will have to be performed by the client when Google responds with the permanent redirect.
- rhubarbquid 15y agoNo, it responds with a redirect: $ curl http://goo.gl/OCK7V <HTML> <HEAD> <TITLE>Moved Permanently</TITLE> </HEAD> <BODY BGCOLOR="#FFFFFF" TEXT="#000000"> <H1>Moved Permanently</H1> The document has moved <A HREF="http://twitter.github.com/hogan.js/1.0.0/hogan.js">here </A>. </BODY> </HTML> Edit: I suppose the headers are more important: $ curl -I http://goo.gl/OCK7V HTTP/1.1 301 Moved Permanently Content-Type: text/html; charset=UTF-8 Expires: Thu, 22 Dec 2011 18:18:46 GMT Date: Thu, 22 Dec 2011 18:18:46 GMT Cache-Control: private, max-age=86400 Location: http://twitter.github.com/hogan.js/1.0.0/hogan.js X-Content-Type-Options: nosniff X-Frame-Options: SAMEORIGIN X-XSS-Protection: 1; mode=block Server: GSE Transfer-Encoding: chunked
- adgar 15y ago> I'm thinking it may possibly respond immediately with cached results. Just because nobody explicitly said it - a 301 redirect is actually cacheable per §10.3.2 of RFC 2616. But google doesn't set a long cache duration - another one of your responders posted the response headers, it was 86400s which is 1 day.
- adgar 15y agoIt's almost as if they think RTTs are free.
- Skywing 15y agoOh, I understand. Whenever I read the Hogan site, initially, I didn't realize that they were suggesting that people actually use that URL in production.
- thenduks 15y agoOf course they aren't advocating that. They're just saying you can try it out by dropping that script tag on your page. Their first suggestion, and the one they are definitely implicitly recommending, is: "Use it as a part of your asset packager to compile templates ahead of time..."
- rhizome 15y agoIs that why I just got a menu-bar failure message 20sec after the page nominally loads? Terrible. Also, follower notification emails appear to be broken.
- yahelc 15y agoEven worse, goo.gl doesn't actually support HTTPS. So, on HTTPS pages, that will just fail. (It actually just loads google.com)
- mcobrien 15y agoWhat's more is it redirects to a GitHub-hosted URL. Maybe it's just me, but it seems cheap that twitter would advocate hotlinking off a GitHub server when they have so much capacity of their own.
- Raphael 15y agoI would have expected //t.co
- fat 15y agolol sorry, i'll take the blame for that. The link was originally just a placeholder for our awesome designer @dhg (who rocked the site in like an hour). I missed the link before it got pushed, and forgot to swap it out. When first published it didn't even point to an actual js page. :( Anyways, I've fixed the redirect, but should have just removed the link all together. I've updated it now to point directly to github. The main reason that we're using github to host this (and bootstrap) rather than a proper cdn is because it makes publishing new versions super fast and easy. Of course we don't recommend that you hotlink from github for any serious application. You should bundling these with your other assets :)