0

I am writing a firefox extension that interacts with a JSON server interface. I receive a url to the server which then redirects to the client site that provides the cookie. I need to be able to set this cookie in the users browser without physically loading it in the browser. Is this possible through an AJAX call?

I tried using a hidden iframe, however firefox does not seem to like a php redirect in the iframe. My current solution is to load the site in a second tab that never gains focus and then auto close it when the cookie is set. This is very messy and would prefer something more streamlines.

Any thoughts?

1 Answer 1

0

I have used nsICookieManager2 service successfully although it is not recommended because you need to play well with features like private browsing. Best solution I could come up with was using a hidden <browser> element and using its contentWindow to create XMLHttpRequest objects. You'll certainly want to set allow* properties to false on the docShell beforehand if you go that route.

1
  • I modified this slightly. I used a browser element and set its source to the PHP page which redirected. It is never visible to the user and the cookies are set correctly. Thanks!
    – Ty Smith
    Apr 14, 2010 at 18:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.