0

I have a content script that adds members to Node.prototype. These aren't visible from the Developer Console because of the "isolated world" concept at https://developer.chrome.com/extensions/content_scripts.

How can I create a Chrome Extension whose modifications to Node are visible when using the Developer Tools Console on pages for which the extension was applied?

So the following steps would validate the solution:

  1. (Create the extension with various content_scripts or any other strategies to work around isolated worlds)
  2. Open Chrome and browse to a page for which the extension is applicable
  3. Open Developer Tools Console
  4. Enter the command Node.newMember;
  5. See some POC value appear, such as a string "Hello World" which was set by the extension in (1)

Some background info: This is for an extension that I want to create as a timesaver to make various properties permanently accessible through $0 when selecting various nodes in the DOM.

Trindaz
  • 17,029
  • 21
  • 82
  • 111
  • 3
    If you only need it in the dev console you can switch to content script context: http://stackoverflow.com/a/15197993/1507998 If you really need to inject your code in the page context take a look at this answer: http://stackoverflow.com/a/9517879/1507998 – rsanchez Oct 02 '14 at 00:46
  • @rsanchez's comment with link to http://stackoverflow.com/questions/15194699/why-will-jquery-not-load-in-facebook/15197993#15197993 is the answer – Trindaz Oct 02 '14 at 14:15
  • 1
    @rsanchez You should make that into an answer. – Xan Oct 02 '14 at 17:16

0 Answers0