Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'image blocking from server AND CERTAIN PATH' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
image blocking from server AND CERTAIN PATH
Authored by: cynikal on Nov 28, '02 12:18:24AM

I put CERTAIN PATH in emphasis because I've been looking a way to do this for a while..

We all know mozilla can block images from certain servers but what happens if the website both the images and the ads from the server? You will block both the images you want to see and the ads also if you 'block images from server'.

Well i did some research and it turns out, you can use userContent.css to block IMG's with the SRC attribute beginning with a certain URL.

Here's an example i'm using to block images from the www.nytimes.com web site. Since all the images are served from graphics7.nytimes.com but ONLY ads begin with the /adx/images or /ads/ path.. here is what i added to my userContent.css:

/* block NYTimes banner ads */
IMG[src^="http://graphics7.nytimes.com/adx/images/"] {
display: none !important;
visibility: hidden !important;
}
/* block NYTimes banner ads */
IMG[src^="http://graphics7.nytimes.com/ads/"] {
display: none !important;
visibility: hidden !important;
}

The trick here is using SRC^= instead of just SRC= so that you match whatever it begins with, instead of an exact match. This is somewhat similar to regular expressions. You can also use use SRC*="/banners/" to match all url that contains /banners/ in the URL. Also there's SRC$='.gif' to match all gif images. I believe this is the extent of CSS3 selector pattern matching. if there's more pattern matching capabilities, please let me know.



[ Reply to This | # ]
image blocking from server AND CERTAIN PATH
Authored by: Johnny_B on Nov 28, '02 01:43:19AM

Is it possible to do this with flash banners as well. If so, how ?



[ Reply to This | # ]
image blocking from server AND CERTAIN PATH
Authored by: cynikal on Nov 29, '02 12:10:26PM

you have to make sure you're putting the file, userContent.css in the right path.. it should be something like

/Users/<yourUserName>/Library/Applications_Support/Chimera/Profiles/default/<randomstring>.slt/chrome/userContent.css

the _ should be a space and the stuff in < > should be changed (but not include the brackets < >).

Also you need to be using a netscape/mozilla/chimera flavor browser of course (the above only applies to Chimera, the paths are different for the other two browsers).



[ Reply to This | # ]
image blocking from server AND CERTAIN PATH
Authored by: cynikal on Nov 29, '02 12:11:44PM

oops, the above reply was meant for the guy who said he couldn't get it to work.



[ Reply to This | # ]
image blocking from server AND CERTAIN PATH
Authored by: cynikal on Nov 29, '02 12:42:34PM

this hint is ABOUT flash banners! Your flash banner is probably a different size.. the original hint is size-dependant.

Look at the html source and determine the dimensions of the flash banner. Then take the sample code from the original hint and change the dimensions listed.

Note that css applies to html definitions, meaning it only works if in the html the dimensions are specified (i.e. for an image), but if the dimensions aren't specified then the dimensions of an image are irrelevant.



[ Reply to This | # ]
image blocking from server AND CERTAIN PATH
Authored by: whoadoggy on Nov 28, '02 03:35:02AM

I have tried these hints with no success yet. It looks like the userContent.css file doesn't get loaded even after a quit/restart. Is there some cache that could need to be dumped in order for this to function?
Thanks



[ Reply to This | # ]
image blocking from server AND CERTAIN PATH
Authored by: cynikal on Nov 29, '02 12:37:30PM

Sorry i meant to reply to you here:

http://www.macosxhints.com/comment.php?mode=display&sid=20021127061854547&title=image+blocking+from+server+AND+CERTAIN+PATH&type=article&order=&pid=14894



[ Reply to This | # ]
CSS just hide items, but...
Authored by: gabble on Nov 28, '02 04:43:27AM

If you set a diplay rule to 'none' and/or visibility to 'hidden', you just hide items, but they still get loaded along with the page. What's the point, then? This trick does not reduce page loading time at all...

There should be a way to skip HTTP requests of specified (by name, path, or both) page elements...



[ Reply to This | # ]
CSS just hide items, but...
Authored by: metiure on Nov 28, '02 11:12:46AM

the solution is to use commercial filters like NetBarrier, which can easily be configured to deny requests to most ads servers. This way, connection speed improves amazingly!

vic



[ Reply to This | # ]
works great -- thanks
Authored by: kwalker on Nov 28, '02 02:29:29PM

This works great for me. I had been looking for a way to block only certain paths from a server (something iCab was very good at). Thanks!



[ Reply to This | # ]