tomsseisums
tomsseisums

Reputation: 13357

Determine whether CSS requested the file

Is there a way to determine whether the file has been requested by CSS? Assuming that everything goes through a master file index.php.

Upvotes: 2

Views: 118

Answers (2)

tomsseisums
tomsseisums

Reputation: 13357

I have managed to get this done, a pretty hacky way, but possible.

Basicly, the router (a PHP one) works with masks, and some files can only be accessed if the mask has been set.

When loading CSS file, I set the required mask, when loading the corresponding images I check for the mask and if it matches the required one, I load display the image. So, when looking at the rendered page it works, but when accessing the file directly, it does not.

Mask is a SESSION variable for now, that gets unset after file routing.

I will get a clean working example and update this answer with it sometime in future.

Upvotes: 0

Martin
Martin

Reputation: 1822

Unless you append a get parameter to it like in

background:url('bg.jpg?myParam');

the requests browser makes from img tag and css definition do not differ.

Upvotes: 3

Related Questions