I think this can be done with js..
Let's say i want to block loading images from example.com or even with a single image path?
I prefer the first variant. can i do this?
Example:
if a image is displayed in html with http://example.com/filepath, don't allow to display images from that dom开发者_StackOverflow中文版ain or even the file path.
Probably not. You can add JavaScript at the bottom of the page or using the onLoad
event but at that time, the browser might have already started the requests to load the images (it can start with that as soon as it reads the image URL).
There simply is guarantee that your JavaScript executes before the highly-optimized URL loading of the browser kicks in.
You also can't load the other page in an iframe
thanks to Same Origin Policy.
Instead, you should configure a proxy like Privoxy or use something like AdBlock.
With Firefox you can Greasemonkey to do exactly this with all the power of Javascript.
If you don't mind using jquery
on body tag
<body onload="remove()">
javascript(jquery)
function remove()
{
$('img').each(function() {
if(this.src.search('somehostname') != -1)
$(this).remove();
});
}
Not sure if they fired image request or not ,but they won't come in your sight for sure
精彩评论