Live data from Hacker News

"//" should indicate a URL

skyb.us

1–10 of 28 posts

Re: "//" should indicate a URL

#2
The // prefix is actually used for protocol-relative URLs. So //google.com leads to https://google.com on a page with SSL, and it leads to http://google.com on an unencrypted page.

See:

http://nedbatchelder.com/blog/200710.html#e20071017T215538

http://paulirish.com/2010/the-protocol-relative-url/

Re: "//" should indicate a URL

#3
post #2

The // prefix is actually used for protocol-relative URLs. So //google.com leads to https://google.com on a page with SSL, and it leads to http://google.com on an unencrypted page. See: http://nedbatchelder.com/blog/200710.html#e20071017T215538 http://paulirish.com/2010/the-protocol-relative-url/

Doesn't seem like it would be that abusive for it to end up being "auto-detect" when there is nothing to be relative to.

A "//" link in an HTTPS site would be required to be the same protocol anyway. It's only the spdy->http fallback that could prove to be a nuisance.

Re: "//" should indicate a URL

#5
I assume that the author intends // to replace http://, and that all other protocols such as ftp, https, etc. would still be written?

If that's the case, why bother with the // at all? Why not just assume, as most browsers already do, that there's an inferred http:// at the beginning of whatever the user types in the address bar?

(EDIT - I see that he's talking about how we would refer to URLs in things like print advertisements. Cute idea, but given the ubiquity of web addresses in mass media, and the time it takes for the public to learn anything new, it still sounds like a solution in search of a problem. The average American is still not sure how Twitter works, or what it means when they see a @name or a #tag.)

Re: "//" should indicate a URL

#6
post #2

The // prefix is actually used for protocol-relative URLs. So //google.com leads to https://google.com on a page with SSL, and it leads to http://google.com on an unencrypted page. See: http://nedbatchelder.com/blog/200710.html#e20071017T215538 http://paulirish.com/2010/the-protocol-relative-url/

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:

  
  Testing 1 2 3
  

Linky

Re: "//" should indicate a URL

#7
post #2

The // prefix is actually used for protocol-relative URLs. So //google.com leads to https://google.com on a page with SSL, and it leads to http://google.com on an unencrypted page. See: http://nedbatchelder.com/blog/200710.html#e20071017T215538 http://paulirish.com/2010/the-protocol-relative-url/

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…

You're assuming people care about that use case. I think in most cases it's irrelevant.

Re: "//" should indicate a URL

#8
post #2

The // prefix is actually used for protocol-relative URLs. So //google.com leads to https://google.com on a page with SSL, and it leads to http://google.com on an unencrypted page. See: http://nedbatchelder.com/blog/200710.html#e20071017T215538 http://paulirish.com/2010/the-protocol-relative-url/

Cool, I didn't know that.

// has another meaning in XML XPath, a language for navigating XML documents. // selects nodes anywhere in a document. For example, //p would select all paragraphs in an XHTML page.

Re: "//" should indicate a URL

#9
post #2

The // prefix is actually used for protocol-relative URLs. So //google.com leads to https://google.com on a page with SSL, and it leads to http://google.com on an unencrypted page. See: http://nedbatchelder.com/blog/200710.html#e20071017T215538 http://paulirish.com/2010/the-protocol-relative-url/

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…

wget has switches to replace http with file when saving a website to disk
Post reply on HN