amartine
amartine

Reputation: 819

Style local background image

How do I include a local image for the style background-image URL, that is stored outside my application? Actually, I can only show it in Internet Explorer with this in my CSS:

.class {
    background-image: url(file:///C:/tempfolder/image001.bmp);
}

But I need it to work for any other browser.

Upvotes: 0

Views: 9792

Answers (2)

Chris Eberle
Chris Eberle

Reputation: 48795

As far as I'm aware, most browsers restrict mixed-domain requests like this. In this case you're connecting to a remote server while requestion local content. Even though in your case this is perfectly reasonable, this could be put to malicious use. I believe that the simple answer is: you can't do it because of security concerns.

Upvotes: 0

Soufiane Hassou
Soufiane Hassou

Reputation: 17750

Use relative paths, for example:

.class {
    background-image: url(../tempfolder/image001.bmp);
}

Upvotes: 1

Related Questions