Chrome extension doesn't work in HTTPS?

73 views
Skip to first unread message

Grev

unread,
Jan 12, 2011, 6:04:43 AM1/12/11
to Chromium-extensions
Hey all,

I am trying out creating my first extension. I have made a Jquery file
that places a 5px red border around all images on a page as a test,
and works OK in sites such as BBC News, Google etc. However when
accessing GMail at work, via https://mail.google.com/... it does not.

Are there known issues with extensions accessing https sites?

Adam

unread,
Jan 13, 2011, 2:36:04 PM1/13/11
to Chromium-extensions
The problem is that GMail uses Iframes. By default, Content Scripts
are not injected into Iframes.

"content_scripts": [
{
"matches": ["https://*/*", "http://*/*"],
"js": ["js/jquery.js", "js/img_border.js"],
"run_at": "document_end",
"all_frames": true
}
]

the above code will inject your two js files (in order they appear in
the array....so scripts dependant on jQuery should be injected AFTER
jQuery) into each and every page that uses http or https

it will run at document_end (the same as
DOMContentLoaded....essentially its after the DOM is ready, but before
onLoad fires)

all_frames ensures your content script is run in all frames.


Also, check your permissions in manifest.json. For your extension, you
probably need something like this:

"permissions": [
"tabs", "http://*/*", "https://*/*"
]

That will give you carte blanche access to all URLs (except chrome
specific pages....ones that use some kind of chrome:// protocol)

Hope that answers your question!

-Adam

On Jan 12, 6:04 am, Grev <thegrevs...@ukspotlight.co.uk> wrote:
> Hey all,
>
> I am trying out creating my first extension. I have made a Jquery file
> that places a 5px red border around all images on a page as a test,
> and works OK in sites such as BBC News, Google etc. However when
> accessing GMail at work, viahttps://mail.google.com/... it does not.
Reply all
Reply to author
Forward
0 new messages