Questions tagged [protocol-relative]

Protocol-relative URLs are URLs beginning with //. An example is //example.com/file.js. They allow specifying all parts of the URL except the protocol, which is the same as the current page. This mechanism helps avoid mixed content warnings between HTTP and HTTPS.

28 questions
244
votes
7 answers

Can I change all my http:// links to just //?

Dave Ward says, It’s not exactly light reading, but section 4.2 of RFC 3986 provides for fully qualified URLs that omit protocol (the HTTP or HTTPS) altogether. When a URL’s protocol is omitted, the browser uses the underlying document’s protocol…
a paid nerd
  • 28,574
  • 30
  • 121
  • 167
94
votes
4 answers

URI starting with two slashes ... how do they behave?

Lately I saw working code-blocks like this: And according to RFC 2396 (URI Syntax) and RFC 2616 (HTTP 1.1) these URI starting with two slashes…
pagid
  • 12,173
  • 10
  • 70
  • 96
87
votes
3 answers

Absolute URLs omitting the protocol (scheme) in order to preserve the one of the current page

I saw the //somepage.com/resource url format. For example: The point of this is that if the current page (the page defining the img tag) is using http, then the request to the remote site is made via http.…
Bozho
  • 554,002
  • 136
  • 1,025
  • 1,121
60
votes
2 answers

Network-Path Reference URI / Scheme relative URLs

Scheme relative URLs (network-path references) are something that I've just found out about - where you don't specify the scheme of a URL and it picks it up from the current context. For example: will resolve to…
Jonathon Bolster
  • 15,221
  • 3
  • 39
  • 46
30
votes
1 answer

Links start with two slashes

More and more, began to notice that the links in the source code on Web sites begin with two slashes. For example: Image Why do it?
Kirill Firsov
  • 499
  • 1
  • 7
  • 16
13
votes
3 answers

Preventing secure/insecure errors by using protocol relative URLs for image source

Is anyone aware of whether it is problematic to use protocol relative URLs for an image source to prevent mixed content security warnings. For example linking an image like: instead of:
robjmills
  • 17,839
  • 14
  • 71
  • 118
10
votes
1 answer

What is the effect of starting a url with "//", and leaving out "http:"

Possible Duplicate: Absolute URLs omitting the protocol (scheme) in order to preserve the one of the current page I recently noticed that the embed codes for the "like" and "tweet" buttons don't include the http protocol. For example:
defrex
  • 13,028
  • 7
  • 32
  • 44
10
votes
3 answers

How to implement Schema.org on HTTPS pages?

Is it correct to statically set up Microdata’s itemtype attribute with HTTP value (http://schema.org/WebPage) on HTTPS pages or do I need to use HTTPS value (https://schema.org/WebPage) on all pages? Since both HTTP and HTTPS versions of the site…
Noel Jose
  • 103
  • 6
10
votes
2 answers

Are protocol-relative URLs relative URLs?

So consider a protocol-relative URL like so; //www.example.com/file.jpg The idea I've had in my head for as long as I can remember is that protocol-relative URLs are in fact absolute URLs. They behave exactly like absolute URLs, and never do they…
Emphram Stavanger
  • 3,690
  • 8
  • 33
  • 57
10
votes
2 answers

Using protocol-relative URIs within "Location:" headers

I note in the PHP manual which states the following: HTTP/1.1 requires an absolute URI as argument to » Location: including the scheme, hostname and absolute path, but some clients accept relative URIs. To facilitate users with preference for…
Question Overflow
  • 9,707
  • 18
  • 68
  • 108
8
votes
2 answers

Why using href="// instead of href="http:// in HTML?

Why using instead of using http:// or https:// before the domain name? If we use href=// does it changes with link? Like while in SSL mode will it automatically be changed to https://?
DasCodes
  • 334
  • 4
  • 15
6
votes
1 answer

UIWebView doesn't load images from protocol-relative URL

Make an app with UIWebView which open a webpage with protocol-relative styles & images, such as (examples for http or https). Override the page loading process via your custom NSURLConnection, this way. Result:…
Dmitry Isaev
  • 3,463
  • 2
  • 32
  • 47
5
votes
2 answers

gulp-sass compiles Google Fonts CSS into the file, breaks protocol-relative link

When I use the following code in my .scss file @import url('//fonts.googleapis.com/css?family=SomeFont:400,700,400italic'); the SASS parser I use (nodejs gulp-sass) happily downloads the file from said location and includes it as plain text in the…
SeinopSys
  • 8,028
  • 9
  • 55
  • 102
4
votes
1 answer

Chrome not honoring protocol-relative URL references?

I have noticed today for the first time that Chrome (and only Chrome) does not pay attention to protocol-relative URL references. For example: google-chrome
user1190300
1
2