2

Sometimes I see script src or image src without schema, only two leading slashes //

From http://www.performable.com/ home page

<script src="//d2f7h8c8hc0u7y.cloudfront.net/performable/pax/8uEvsz.js"></script>

http://www.hellobar.com/ home page - and their integration code

<script type="text/javascript" src="//www.hellobar.com/hellobar.js"></script>

I've integrated both on my site and see errors in apache log similar to

www.mysite.com//www.hellobar.com/hellobar.js not found

However they're rare - less than 1%.

I think double leading slashes is a replacement for http\https and such links will use current page schema. Can someone confirm that?

Also, which browsers have support for that urls and which have problems?

Kai
  • 1,478
  • 2
  • 15
  • 15
  • 2
    possible duplicate of [URI starting with two slashes ... how do they behave?](http://stackoverflow.com/questions/4071117/uri-starting-with-two-slashes-how-do-they-behave) – Quentin May 14 '11 at 07:47
  • 1
    Yes, it's a duplicate. Unfortunately, google don't search by // – Kai May 16 '11 at 07:22
  • 1
    Possible duplicate of [Absolute URLs omitting the protocol (scheme) in order to preserve the one of the current page](http://stackoverflow.com/questions/4978235/absolute-urls-omitting-the-protocol-scheme-in-order-to-preserve-the-one-of-the) – Matas Vaitkevicius Jun 13 '16 at 14:23

1 Answers1

2

This was discussed multiple times here. Yes it is safe and yes all browsers support this.

redsquare
  • 78,161
  • 20
  • 151
  • 159
DanielB
  • 19,910
  • 2
  • 44
  • 50