Thanks PhistucK, but in this way I have access to the javascript
variables in the page?
I want to show these variables, for example, in a devtools panel.
On 2 sep, 15:46, PhistucK <
phist...@gmail.com> wrote:
> You can inject, into the DOM, your code and it will operate within the
> context/world of the page.
> var script = document.createElement("script");
> script.src = chrome.extension.getURL("some-script.js");
> document.documentElement.appendChild(script);
>
> Note that you have to add the host of the page (in which you want to inject
> such a script) to the "permissions" key within the manifest.
> Either that, or do this -
> function someFunction()
> {
> alert("");}
>
> var script = document.createElement("script");
> script.textContent = "alert('')"; // Option 1 - inline.
> script.textContent = "(" + someFunction.toString() + "())"; // Option 2 -
> toString of a function from this script.
> script.textContent = requestedScript; // Option 3 - load the script using
> sendRequest (and a background page) or XMLHttpRequest and assign the string
> to requestedScript, though it sounds like an overkill.
> document.documentElement.appendChild(script);
>
> Note that you cannot call extension APIs from the context/world of the page,
> you will have to contact your content script world using custom events or
> similar ways.
>
> ☆*PhistucK*
>
>
>
>
>
>
>
> On Fri, Sep 2, 2011 at 17:31, Noelia Franco <
noeliasfra...@gmail.com> wrote:
> > Hello,
> > I'm trying to make an extension to monitor and debug jquery. To do
> > this I need to access the runtime environment of the page to retrieve
> > the actual state of the javascript variables.
> > I know that the content script lives in a different world than the
> > world of the web page, and that only the DOM is shared, not the
> > global variables. This is a limitation to continue developing my
> > extension.
> > I'd like to know if it's possible to do this from within an
> > extension. If not, is there any chance that it may be available in
> > the future?
>
> > Thanks in advance!
>
> > Regards
>
> > Noelia S. Franco
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Chromium-extensions" group.
> > To post to this group, send email to
chromium-extensi...@chromium.org.
> > To unsubscribe from this group, send email to
> >
chromium-extensions+unsubscr...@chromium.org.