Are there situations where omitting the protocol in http:// or https:// will fail to work in certain browsers? [duplicate]
Possible Duplicate:
Can I change all my links to just //?
I.e. if I do: //www.google.com
it would point to http://www.google.com
or https://www.google.com
depending on what the current protocol is. Are there browsers that is reasonable to support where this doesn't work, if so which?
This would work on all browsers according to RFC 3986 Section 4.2. They call it relative reference.
Further more I have seen good JavaScript coders using it / recommending it
- The protocol-relative URL by Paul Irish
- Cripple the Google CDN’s caching with a single character by Dave Ward
Furthermore you can find related questions here and here.
精彩评论