tags:

views:

78

answers:

6

I wish to browse the DOM of an (arbitrary) web page to extract data and think jQuery would simplify the navigation problem. So after the browser, say IE, finishes loading a page (that does not already use jQuery), how can I:

  • attach jQuery to the page's Document object?
  • invoke a jQuery function via DOM?

I appreciate your reply.

+1  A: 

You can load jQuery or any other JS file dynamically: http://stackoverflow.com/questions/1618351/loading-js-files-dynamically-via-another-js-file After loading jQuery, you simply invoke the functions as documented on their website; you don't need to attach jQuery to the DOM.

Upper Stage
+1  A: 

You can, with Firefox, use the user.js, or perhaps Greasemonkey.

David Thomas
A: 

Greasemonkey is just the best

joberror
+2  A: 

If you are using this for simple tasks that you have control over, I would recommend using Firebug and FireQuery together. You can simply click jQuerify and then run jQuery commands in the console to fetch information.

Doug Neiner
+1  A: 

You can use this bookmarklet "jQuerify" seamlessly with Firefox and Firebug. http://www.learningjquery.com/2009/04/better-stronger-safer-jquerify-bookmarklet.

Chakri Bireddy
A: 

Perfect extension to embed jQuery into Chrome Console as simple as you can imagine. This extension also indocates if jQuery has been already embeded into page.

This extension used to embed jQuery into any page you want. It allows to use jQuery in the console shell (You can invoke Chrome console by "Ctrl+Shift+j").

To embed jQuery into selected tab click on extention button.

LINK to extension: https://chrome.google.com/extensions/detail/gbmifchmngifmadobkcpijhhldeeelkc

Andrey