how to get a callback using chrome.tabs.executeScript

2,217 views
Skip to first unread message

キューゾ リファイ

unread,
Feb 12, 2012, 2:38:32 PM2/12/12
to Chromium-extensions
Hello, I'm trying to execute a script on a tab from background.html,
but I don't know how to make the tab respond to my script.
I tried console.log() but failed.

Any suggestions please.

Mohamed Mansour

unread,
Feb 13, 2012, 7:48:53 PM2/13/12
to キューゾ リファイ, Chromium-extensions
Hey there,

When you call the executeScript, the callback for that function gets fired when the JavaScript has been executed. To get a response back, you would need to use extension Message Passing to pass the message from the content script (that gets executed) to your background/popup/options/etc page that initiated that executeScript call.

For more information regarding Message Passing, the docs has a good set of examples:

Kind regards,
Mohamed Mansour
http://mohamedmansour.com/+   



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


Reply all
Reply to author
Forward
0 new messages