On Sat, Oct 3, 2009 at 10:24 AM, Andy Mitchell <[email protected]> wrote:
> That's a great idea, but I was under the impression - based on very
> limited play time with Chrome! - that content scripts had no direct
> access to the Javascript objects in the page?

By default, that is true, but there are always going to be use cases
for interacting with the JS in pages. We are just trying to set things
up so that by default, the environment extensions run in is as safe as
possible.

> Actually, I've just found 
> http://www.aaronboodman.com/2009/04/content-scripts-in-chromium.html
> which is a fantastic intro.
> (A link to, or variation of this would be great on the new extension
> site).

I think that http://code.google.com/chrome/extensions/content_scripts.html
covers some of this.

> Is that blog post still accurate?

Yes!

> Or perhaps more usefully for others reading this, is there a best
> practice for accessing in page variables? (e.g. gmonkey, the XHR
> prototype)
>
> The choices I can see...
> 1) contentWindow - you talk about closing this off, is it going to be
> around for the foreseeable future?

Actually contentWindow is gone.

> 2) Inject a <script> element into the page with the wrapping code, and
> use DOM elements/events to pass data back out.

This is the current best-practice. See:
http://code.google.com/chrome/extensions/content_scripts.html#host-page-communication

> It's great to be able to hear directly from you guys, any insight on
> this particular topic would be very useful indeed :)

Take a look at that last link. It's not the most convenient thing in
the world, but it should work.

- a

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Chromium-extensions" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/chromium-extensions?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to