-1
.bg-img {
  background-image:url(data:image/png;base64,iVBORw0KGgoAAAA... etc );
}

How can I refer to that image with an https prefix? When I go to the CSS that's how I see it.

Normally when you have an image src you can do the following:

background-image: url(https://domain.com/photo.png);

How can I use https for the data URI?

ariel
  • 2,962
  • 7
  • 27
  • 31
  • HTTP(S) is not involved here at all. Totally unclear what you’re asking. – CBroe Jan 21 '14 at 15:25
  • @CBroe just updated my description. please see again. thanks. – ariel Jan 21 '14 at 15:41
  • Still doesn’t make any more sense. _“How can I use https for the data URI?”_ – since the data _is not requested_ via HTTP, you can not add the “S” for secure HTTP for it. Maybe you should go read up on what a [Data URI](http://en.wikipedia.org/wiki/Data_URI_scheme) actually _is_ … – CBroe Jan 21 '14 at 15:44
  • @CBroe sorry i am new to this. So when you have a url like domain.com/photo.png you are basically generating a uri for it, correct? If so, that uri is hosted somehwere, no just like another image? – ariel Jan 21 '14 at 15:46
  • A Data URI does not represent an _address_, it represents _data_. All the information of the (in this case) image is embedded _inside_ this URI, in the base64 encoded data part. – CBroe Jan 21 '14 at 15:48
  • data:image (data URI's) are now considered to be insecure so you'll have to link to an image for that instead, I reckon: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs (look down the page to Security section) – Nathaniel Flick Apr 27 '18 at 05:25

1 Answers1

0

You can't. DATA URI inherits the protocol of the page it's in. If your html is on https the data uri will have the same features of https. If your html is on http the data uri will have the same features of http.

Zibri
  • 9,096
  • 3
  • 52
  • 44