Extension API Accessible from loaded web page - Mozilla

This is a discussion on Extension API Accessible from loaded web page - Mozilla ; Could someone tell me if it is possible to expose an API created as part of an extension to scripts running in the user space of a web page. Specifically, I would like to look for images in the loaded ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Extension API Accessible from loaded web page

  1. Extension API Accessible from loaded web page

    Could someone tell me if it is possible to expose an API created as
    part of an extension to scripts running in the user space of a web
    page. Specifically, I would like to look for images in the loaded web
    page and add some properties and methods that the web page can call.

  2. Re: Extension API Accessible from loaded web page

    On Oct 12, 2:37*am, "John J. Barton"
    wrote:
    > peterbayley wrote:
    > > Could someone tell me if it is possible to expose an API created as
    > > part of an extension to scripts running in the user space of a web
    > > page. *Specifically, I would like to look for images in the loaded web
    > > page and add some properties and methods that the web page can call.

    >
    > Yes, for example, Firebug adds window.console to a web page. However it
    > is not easy to do because these additions need to be as secure as
    > Firefox itself. You compile properties and methods into the page the
    > same way the page would do: you add a 'script' tag. You learn about
    > calls to your new API the same way you learn other things about the
    > page: you listen for events. These are your new event types, added with
    > your new 'script' tag. Then you ensure that the data from these events
    > can never cause arbitrary code to run, no eval or similar structure.
    >
    > jjb


    Thanks for that John, I'll try your suggestions

    Peter

+ Reply to Thread