views:

721

answers:

2

Hi, Is there any way I can use JavaScript (or jquery) to stop loading unwanted objects on a webpage if i'm not interested in them. I use greasemonkey firefox addon to use bits of javascript for my better web experience and some sites use excessive flash and image content that is irrelevant to me. I'm able to hide their display using jquery but it happens after the full page has been loaded.

Can I stop loading those irrelevant objects on a webpage and also save lots of my bandwidth?

+1  A: 

If you use Firefox (which it appears you do, given the use of Greasemonkey), then I would suggest looking into the AdBlock Plus plugin. I think that it cuts off requests to certain domains or url paths that you specify such that they don't even get loaded (someone please correct me if I am wrong on that assumption). You can find the Firefox plugin/extension/addon (whatever they call it these days) here.

The main problem with a JavaScript approach (such as jQuery and Greasemonkey) is that those don't start their work on a page until it has finished loading.

Matt
A: 

"The main problem with a JavaScript approach (such as jQuery and Greasemonkey) is that those don't start their work on a page until it has finished loading."

I am confident that the above statement is false. In jquery you can do a $(document).ready(function(){.. and fill in your javascript there to traverse the DOM and remove elements on the page that are either images or swf objects. The above statement will execute before image on the page are loaded, I am unsure about swf/flash.

There are also firefox plugins as mentioned that can do this for you.

aaron