How to dynamically change CSS elements to be HTTPS or HTTP
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 HT开发者_开发问答TPS or NOT...
And I MUST use absolute... (its on a different site)
Thanks!
Just omit the protocol (http:
or https:
) in your URLs: //domain/path/image.png
will use the same protocol as the current page.
The solution would be if you can use relative url
instead of absolute
in your CSS file while pointing background images.
The problem will gone.
something like:-
#div
{
background-image:url(../images/img1.png);
}
精彩评论