Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do i 'share cookies' in opera extensions?

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?

like image 717
anonim1133 Avatar asked Dec 21 '25 07:12

anonim1133


1 Answers

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

like image 147
shwetank Avatar answered Dec 22 '25 20:12

shwetank



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!