tags:

views:

23

answers:

1

I was recently asked to add some Woopra JavaScript to a website and noticed that the URL started with a double slash (i.e. omitted the scheme). I've never seen this before, so I went trying to find out more about it, but the only thing I could really find was an item on the Woopra FAQ:

The Woopra JavaScript in the Setup does not include http in the URL call for the script. This is correct. The JavaScript has been optimized to run very fast and efficiently on your site.

However, some validation and site testing/debugging services and tools do not recognize the code as correct. It is correct and valid. If the warnings annoy you, just add the http to the script’s URL. It will not impact the script.

(For clarification, the URL is "//static.woopra.com/js/woopra.v2.js"—the colon is omitted in addition to the "http".)

Is there any more information about this practice? If this is indeed valid, there must be a spec that talks about it, and I'd very much like to see it.

Thanks in advance for satisfying my curiousity!

A: 

See RFC 3986, section 3:

The generic URI syntax consists of a hierarchical sequence of components referred to as the scheme, authority, path, query, and fragment.

  URI         = scheme ":" hier-part [ "?" query ] [ "#" fragment

]

  hier-part   = "//" authority path-abempty
              / path-absolute
              / path-rootless
              / path-empty

The scheme and path components are required, though the path may be
empty (no characters).

chryss
So Woopra is just plain wrong about it being "correct and valid"?
matthew