How do i 'share cookies' in opera extensions?

271 Views Asked by At

I'm trying to write my first extension for Opera. Its speeddial extension. I want it to show me some data from website, but to acces these data I need to be logged in.

I'm logged in, and opera knows it ;-) (When I type website's adress in Opera's adress bar, then everything works just fine.) And i want Opera to tell JS, that i`m logged in ;-)

But when I try to get that website in js, i get text, that says, that i need to be logged in:

    r_xmlhttp.open("GET",url,true);
    //r_xmlhttp.withCredentials = 'true'; //even with that on, nothing changes.
    r_xmlhttp.onreadystatechange = user_func;
    r_xmlhttp.send();

My config.xml(that`s one from tutorial;-), added acces origin, and feature opera:share-cookies:

    <?xml version="1.0" encoding="utf-8"?>
    <widget xmlns="http://www.w3.org/ns/widgets" id="http://example.com/SimpleClockSD" defaultlocale="en" viewmodes="minimized">
    <name short="Simple Clock">Clock Speed Dial Extension</name>
    <description>This is an example Speed Dial extension showing a simple clock.</description>
    <author href="http://people.opera.com/danield/">Daniel Davis</author>
    <icon src="images/icon_64.png"/> <!-- Icon source: http://www.openclipart.org/detail/17552 -->
    <feature name="opera:share-cookies" required="false"/>
    <access origin="http://wykop.pl" subdomains="true"/>
    <feature name="opera:speeddial" required="false">
    <param name="url" value="http://wykop.pl"/>
    </feature>
    </widget>

I looked up what is going on with wireshark, and i can tell that Opera sends other cookies than JS, and that's why JS says i'm not logged in. But i want JS to send the same cookies that opera sends, and theoretically it should do it, becouse i added feature called "opera:share-cookies", right?

What do I do wrong?

2

There are 2 best solutions below

0
On

It should work, however, for initial development, try setting access-origin as * and then try. Also, try to be carefull with regards to access origin (www, and a domain without www). For now, try setting access origin as *, and see if it works or not. (In production, access origin * will probably not be allowed by the moderators though).

0
On

Had same problem, your extension is most likely working but not in the developer mode for some reason. When you zip it, rename to .oex and install as normal extension, it will probably work.