2

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?

Community
  • 1
  • 1
Kit Sunde
  • 34,128
  • 23
  • 115
  • 177

1 Answers1

4

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

  1. The protocol-relative URL by Paul Irish
  2. Cripple the Google CDN’s caching with a single character by Dave Ward

Furthermore you can find related questions here and here.

Community
  • 1
  • 1
naveen
  • 51,042
  • 46
  • 158
  • 241