Cookies Extension problem

1,060 views
Skip to first unread message

Loop

unread,
Jul 27, 2011, 4:27:31 PM7/27/11
to Chromium-extensions
I'm trying to use the google chrome cookies extension when developing
for a chrome extension app. I've followed the instructions found here:
http://code.google.com/chrome/extensions/cookies.html

My manifest file already has the permissions and cookies.

The problem is now I can't seem to call any of the methods in the
cookies extension

var newCookie = {'url:': 'http://*/*', 'name': 'routeCookie', 'value':
route.tag[document.boxForm.routeBox.options.selectedIndex]};
chrome.cookies.set(newCookie);
Error: UnCaught TypeError: Cannot call method 'set' of undefined

Boris Smus

unread,
Jul 28, 2011, 2:36:50 PM7/28/11
to Loop, Chromium-extensions
Hi Kelvin,

Are you sure that you're in a chrome extension context? Note that if you're trying to do this in a content script, you have a restricted set of chrome.* API calls that you can make: http://code.google.com/chrome/extensions/content_scripts.html

- Boris


--
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.


Loop

unread,
Jul 28, 2011, 2:39:55 PM7/28/11
to Chromium-extensions
Boris,

You're right, I'm trying to use the cookies extension on my content
script. Thanks for point that out.

Now I figure I'll just use message passing from my content script to
my background. But the problem is I'm not exactly sure where to start
with this. I'm using document.cookies so would I pass an object with
the cookie name, value and expiry date from my content page into my
background and then create the cookie there? Will I have to use the
google extensions cookies or can I just use standard javascript
cookies?

Thanks

On Jul 28, 2:36 pm, Boris Smus <s...@chromium.org> wrote:
> Hi Kelvin,
>
> Are you sure that you're in a chrome extension context? Note that if you're
> trying to do this in a content script, you have a restricted set of chrome.*
> API calls that you can make:http://code.google.com/chrome/extensions/content_scripts.html
>
> - Boris
>
>
>
>
>
>
>
> On Wed, Jul 27, 2011 at 1:27 PM, Loop <kelvin.lau...@gmail.com> wrote:
> > I'm trying to use the google chrome cookies extension when developing
> > for a chrome extension app. I've followed the instructions found here:
> >http://code.google.com/chrome/extensions/cookies.html
>
> > My manifest file already has the permissions and cookies.
>
> > The problem is now I can't seem to call any of the methods in the
> > cookies extension
>
> > var newCookie = {'url:': 'http://*/*', 'name': 'routeCookie', 'value':
> > route.tag[document.boxForm.routeBox.options.selectedIndex]};
> > chrome.cookies.set(newCookie);
> > Error: UnCaught TypeError: Cannot call method 'set' of undefined
>
> > --
> > 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.
Reply all
Reply to author
Forward
0 new messages