views:

83

answers:

2

Well, greasemonkey can execute users script but only after the page loads fully. Is there any script that can take user script (javascript) and executes it before the page downlaods any elemts. for instance, As soon as the HTML file is downloaded, the user script should execute so that i can prevents the download of embedded elements like flash, jpg, js files downloads

A: 

Take a look here:

I need a functionality to be executed before the page loads. Is it possible?

Not an addon but maybe a way to do that...

Leniel Macaferi
+1  A: 

There's a content-document-global-created notification in the recent versions of Firefox that fires before the page started loading.

Jetpack SDK has a Page mods module that uses that notification to let you write greasemonkey-like snippets. That's kind of an "addon that can make javascript execute before the page loads".

I don't know how you'd implement content blocking via such script, though.

The common way to do content blocking is via nsIContentPolicy, which is what Adblock uses.

Nickolay