Link to home
Start Free TrialLog in
Avatar of ericsama
ericsama

asked on

Prevent image downloading via css

I have a webpage that is built using a rss feed.  This rss feed contains alot of images and stuff I don't want to use / show, so I use css to 'display:none'  on certain tags to not show some images.   The problem is these images are still downloaded via the browser.  Does anyone know how to prevent the browser from downloading these images via css?  I've tried both 'display:none' and 'visibility:hidden' on IE7/8 with no luck.   Thanks
Avatar of abel
abel
Flag of Netherlands image

If you want to prevent them to be download then don't put them in the RSS in the first place. You can also change the URL such that the server understands it  comes from an RSS request, but then you'd still have a roundtrip and you'd have to instruct your server to return with an "empty" image.

The original question: using CSS to prevent downloading, is not possible.

If you'd load the RSS through javascript, for instance with an XHR object and then post-process them by hand you have all the control on what part you include and what not. But I don't know how the RSS is used and whether you have control over that process at all. The easiest is just to leave it out of the RSS to begin with...
As I read it the RSS feed is not yours but you are accessing it to add content to your own site or something similar via your own browser? If this is correct, you want to stop loading the images to save bandwidth? If this is also the case, you can block the host of the RSS feed to not fetch any more images.

This can be done in Firefox (but probbaly also in IE in a similar method) like this:
right click the image and select 'block images from IP'.

Hope this helps...
Avatar of ericsama
ericsama

ASKER

Yes, its a 3rd party RSS feed.  The page is built using this RSS feed so I'm pretty sure the only way to solve this is if there's a way via css so the browser doesn't load the hidden images (which are being hidden by css 'display:none').  I also use some of these images on secondary pages so I don't want to use / write a custom feed reader to disregard them.  These secondary pages only get a little traffic, the home page gets a ton and that's where its downloading a bunch of images that I don't display.  
ASKER CERTIFIED SOLUTION
Avatar of abel
abel
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If you require a second opinion, abel is correct. CSS is used for styling and cannot change functionality.

And as Abel says, you could filter out the images when reading the RSS feed before displaying it. Which programming language are you using?
best answer