News for hackers. Stuff that matters.
Re:"//" should indicate a URL by rufibarbatus on Monday June 27, 2011 @12:23AM (#2700106)
Conversely, the protocol bit is relevant whenever your link is not domain- or protocol-relative, or when you can't be sure.

And you can't be sure. Here's why: if someone saves your page on their hard drive and you're using protocol-relative URLs, the implied "http" just became "file". (Which in fact may be a nice excuse for some clever hacks.)

Test it yourself! Save the following snippet to your computer and see how your browser resolves the URL:

  <!DOCTYPE html>
  <title>Testing 1 2 3</title>
  <p><a href="//google.com/">Linky</a></p>
Re:"//" should indicate a URL by sjs on Monday June 27, 2011 @12:42AM (#2700148)
You're assuming people care about that use case. I think in most cases it's irrelevant.
Re:"//" should indicate a URL by Vivtek on Monday June 27, 2011 @06:54AM (#2700865)
Oh man. Are you really saying that corner cases are a priori negligible? That seems like a dangerous road to start down when you're discussing basic protocols!
Re:"//" should indicate a URL by sjs on Monday June 27, 2011 @12:43PM (#2701930)
If your use case entails people saving your site to disk then you have may not be able to use // for protocol relative links, but most people don't have to worry about such things.

I'm saying that those who need to worry about such things should and the rest of us should not. Nothing more and nothing less.

Re:"//" should indicate a URL by teyc on Monday June 27, 2011 @03:09AM (#2700442)
HTML Base tag is your friend. http://www.w3schools.com/TAGS/tag_base.asp
Re:"//" should indicate a URL by sleepyhead on Monday June 27, 2011 @04:40AM (#2700614)
W3Schools is not your friend. http://w3fools.com/
Re:"//" should indicate a URL by rufibarbatus on Monday June 27, 2011 @08:19AM (#2701028)
And here it is in the specification:

http://dev.w3.org/html5/spec/Overview.html#the-base-element

And accordingly, adding `<base href="http://example.com/ >` to that test above seems to work well on modern browsers.

Re:"//" should indicate a URL by rawsyntax on Monday June 27, 2011 @12:46AM (#2700154)
wget has switches to replace http with file when saving a website to disk