Hi Phistuck,
Thanks for the response.
I consider changing the DOM as a last resort action.
I'm working as a background plugin ( no window or any appearance at
all).
So trying to add the plugin to the background seems reasonable.
But When I tried it ( about a week ago ) I could not access the DOM
(security issues) to handle some plugin internal work.
Is it possible to call a background script from the plugin?
plugin --???--> backgroundScript --chrome.tabs.sendrequest-->
contentScript
On Apr 21, 5:50 pm, PhistucK <
phist...@gmail.com> wrote:
> I would imagine it is a limitation due to the fact that you cannot
> instantiate the object of the plugin inside the content script, because when
> you add it to the DOM, it creates an object inside the page, not the content
> script.
> Two workarounds you may employ -
> - Pass information using hidden DOM elements and custom events
> (JSON.stringify and JSON.parse could be your friends here).
> - Create the plugin within the background page and use message passing
> (chrome.extension.sendRequest) to pass information to the content script and
> back.
>
> The latter applies only if you do not need the plugin to actually show up
> and be visible/interact-able on the page.
>
> ☆*PhistucK*
>
>
>
>
>
>
>
> On Thu, Apr 21, 2011 at 17:40, ikatalan <
ikata...@gmail.com> wrote:
> > Hi,
>
> > I'm trying to pass a message/Event from my plugin to my contentscript
> > that loaded that plugin earlier.
>
> > NPN_Invoke doesn't seem to work when I try to call a function that is
> > in my content script.
> > It works well when I call getElementById or any other 'native' DOM
> > functions.
>
> > I tried using this:
>
> > NPN_GetValue(m_pNPInstance, NPNVWindowNPObject, &sWindowObj);
>
> > NPVariant npvarRetVal;
> > NPIdentifier identifier = NPN_GetStringIdentifier( "myFunc" );
> > NPVariant args;
> > STRINGZ_TO_NPVARIANT("somearg", args);
>
> > if ( !NPN_Invoke(m_pNPInstance, sWindowObj, identifier,&args,
> > 1,&npvarRetVal) )
> > {
> > return false;
> > }
>
> > but MyFunc doesn't get called.
>
> > what can be the problem?
> > Am I using it the wrong way?
>
> > --
> > 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.