Hey Rick.

You could write a content script that parses all links on the page and
sends a message to your background page.

To get an idea of how the content script could look, check this out:
http://github.com/Jacopo/chrome-gmail-no-button/blob/master/mailto.js

You'd have to modify it a bit but the idea is to send a message to
your background page somewhere from that script. See more about
messages here:
http://code.google.com/chrome/extensions/messaging.html

Good luck!

On Dec 17, 3:20 am, rich <atkins...@gmail.com> wrote:
> Hi all.
> I am trying to achieve the following in an extension:
>
> Modify links on the webpage, replacing their action with javascript
> which passes the "href" text (as a string) to my extension.
>
> I am attempting this from a content script by adding a "click"
> eventListener to the anchor.
>
> I get as far as getting the "click" event-listener to fire correctly,
> but I can't figure out how to pass data to my extension.
>
> I have read the following part of the documentation, but I find the
> example very confusing as I've never seen a custom event before.
>
> http://code.google.com/chrome/extensions/content_scripts.html#host-pa...
>
> Is there a simpler example for passing data from web page to
> extension? (either not using custom events ... or with a bit more hand
> holding)
>
> Ultimately I need to get this data to my background page, so this all
> seems rather convoluted... is there an easier way?
>
> many thanks

--

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...@googlegroups.com.
To unsubscribe from this group, send email to 
chromium-extensions+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/chromium-extensions?hl=en.


Reply via email to