moving from permissions to optional_permission: how to handle content_scripts?

62 views
Skip to first unread message

Chris Templin

unread,
May 5, 2013, 2:23:39 PM5/5/13
to chromium-...@chromium.org
Hi,
My extension has an optional feature that interacts with the user's gmail tab. We don't want to mention mail.google.com domains at all in the permission confirmation that the user sees when first installing the extension. So I moved that entry out of the manifest's permissions block and into the optional_permissions block. We also needed to use a content script tied to mail.google.com, but defining this in the manifest causes the 'mail.google.com' permission warning that is sppoking some users. 

I've tried removing the content_script manifest block and using Programmatic Injection instead as describe here. http://developer.chrome.com/extensions/content_scripts.html#pi
However scripts injected that way are not content scripts and don't have access to the needed APIs (chrome.tabs, etc)

Is there some way to get the best of both worlds: use optional_permission, AND get the content scripts added to a matching URL, but only if the user has approved the optional permission?

thanks very much,
Chris

Matt Perry

unread,
May 6, 2013, 2:12:06 PM5/6/13
to Chris Templin, Chromium-extensions
> However scripts injected that way are not content scripts and don't have access to the needed APIs (chrome.tabs, etc)

This is not true. Programmatically injected scripts have the same privileges as content scripts. However, chrome.tabs and other such APIs are not exposed to content scripts in general, regardless of how you inject them.

Your use of optional permissions seems like the right approach otherwise.


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

Reply all
Reply to author
Forward
0 new messages