Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to dynamically change CSS elements to be HTTPS or HTTP

Tags:

html

css

https

ssl

I have CSS with background-image's elements that refer to another site. Problem is, that in IE you can't have resources if you are in HTTP while they are in HTTPS and vise versa.

I am using ASP.NET and I want to find a way of letting the CSS know about if it was requested in HTTPS or NOT...

And I MUST use absolute... (its on a different site)

Thanks!

like image 684
Himberjack Avatar asked Dec 14 '10 08:12

Himberjack


1 Answers

Just omit the protocol (http: or https:) in your URLs: //domain/path/image.png will use the same protocol as the current page.

like image 98
Aaron Digulla Avatar answered Oct 07 '22 00:10

Aaron Digulla