Why is GM_xmlhttpRequest not sending cookies?

1,074 views
Skip to first unread message

Robert

unread,
Feb 20, 2012, 6:39:25 PM2/20/12
to greasemon...@googlegroups.com
Hi,

currently I use XMLHttpRequest to communicate with the site my script is designed for. I use it on a site that needs authentication (by using cookies). It works as expected. Now I tried the same request using GM_xmlhttpRequest because it is a bit easier to use. Esp. using onload instead of monitoring readyState.

But the site always returned its login page. So I found out that no cookies are send when I use GM_xmlhttpRequest. Why?

Of course I could read them from document.cookie and add them as headers. But why not sending them by default if already present?


Or did I miss something?


Regards,
Robert

Robert

unread,
Feb 21, 2012, 6:32:30 AM2/21/12
to greasemon...@googlegroups.com
Hi Anthony,

I have just created https://github.com/greasemonkey/greasemonkey/issues/1521 because I think this is a bug.

Otherwise I have always to use two different methods (xmlhttpRequest & GM_xmlhttpRequest) in the same GM script. It would be much easier to just need one of them. This would reduce my code complexity a lot.

Hope you can fix it soon.

Tnx in advance.


Regards,
Robert

-------- Original-Nachricht --------
Betreff: [greasemonkey-users] Why is GM_xmlhttpRequest not sending cookies?
Von: Robert <enk...@uni.de>
An: greasemon...@googlegroups.com
Datum: Tue Feb 21 2012 00:39:25 GMT+0100
--
You received this message because you are subscribed to the Google Groups "greasemonkey-users" group.
To post to this group, send email to greasemon...@googlegroups.com.
To unsubscribe from this group, send email to greasemonkey-us...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/greasemonkey-users?hl=en.

--
  _ o    Robert H.       http://kurzlink.de/Enkidu70
 |<)_/#
 TT <T   enk...@uni.de

  "Du wirst da hinein geboren was Du nicht bist, um zu erfahren wer Du wirklich bist!"

dindog

unread,
Feb 21, 2012, 10:34:43 AM2/21/12
to greasemonkey-users
That is one of many reason I switch to Scriptish...

On Feb 21, 7:32 pm, Robert <enk...@uni.de> wrote:
> Hi Anthony,
>
> I have just createdhttps://github.com/greasemonkey/greasemonkey/issues/1521because I think
> this is a bug.
>
> Otherwise I have always to use two different methods (xmlhttpRequest &
> GM_xmlhttpRequest) in the same GM script. It would be much easier to
> just need one of them. This would reduce my code complexity a lot.
>
> Hope you can fix it soon.
>
> Tnx in advance.
>
> Regards,
> Robert
>
> -------- Original-Nachricht --------
> Betreff: [greasemonkey-users] Why is GM_xmlhttpRequest not sending cookies?
> Von: Robert <enk...@uni.de>
> An: greasemon...@googlegroups.com
> Datum: Tue Feb 21 2012 00:39:25 GMT+0100
>
>
>
>
>
>
>
>
>
> > Hi,
>
> > currently I use XMLHttpRequest to communicate with the site my script
> > is designed for. I use it on a site that needs authentication (by
> > using cookies). It works as expected. Now I tried the same request
> > using GM_xmlhttpRequest because it is a bit easier to use. Esp. using
> > onload instead of monitoring |readyState|.
>
> > But the site always returned its login page. So I found out that *no
> > cookies are send when I use GM_xmlhttpRequest. Why?*
>
> > Of course I could read them from document.cookie and add them as
> > headers. But why not sending them by default if already present?
>
> > Or did I miss something?
>
> > Regards,
> > Robert
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "greasemonkey-users" group.
> > To post to this group, send email to greasemon...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > greasemonkey-us...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/greasemonkey-users?hl=en.
>
> --
>
>    _ oRobert H.  <mailto:enk...@uni.de>        http://kurzlink.de/Enkidu70
>   |<)_/#
>   TT<T   enk...@uni.de  <mailto:enk...@uni.de>

Robert

unread,
Feb 21, 2012, 6:33:58 PM2/21/12
to greasemon...@googlegroups.com

> That is one of many reason I switch to Scriptish...

I never seriously thought about changing to Scriptish. But I have to
admit that with Scriptish GM_xmlhttpRequest works as I expect it...

Robert

Robert

unread,
Mar 11, 2012, 9:47:10 AM3/11/12
to greasemon...@googlegroups.com

That is one of many reason I switch to Scriptish...

I never seriously thought about changing to Scriptish. But I have to admit that with Scriptish GM_xmlhttpRequest works as I expect it...

Well... After this reply to my bugreport (https://github.com/greasemonkey/greasemonkey/issues/1521) I also will switch to Scriptish! (And of course many others that want to use my scripts soon will move too!)


Because this is simply not true! And I do not like that kind of acting. I am no liar! I can show what I am reporting!

The behavior of Scriptish is identical to Greasemonkey: cookie transmission depends on the third-party cookie setting. Closing this as a dupe of #1169.

(And what I said is that as far as GM_xhr goes, every request is cross origin because they all start in the privileged chrome origin, which can access any remote url -- but then they are all "third party".)

Closed

I am pissed off, sorry. Also no reply to my objecton!

Sorry, this is definitly not true for Scriptish! My system does not allow third party cookies but using Scriptish it works as I expect it.

Here on my system Greasemonkeys GM_xmlhttpRequest does NOT send the cookies to the site my userscript is designed for! But XMLHttpRequest and Scriptish implementation of GM_xmlhttpRequest DOES send them!

Please note: I installed the same userscript in the same browser, so I am using exactly the same settings concerning cookies ecc. On time in Greasemonkey, on time in Scriptish.



In addition to that, www.Socialfixer.com 's Friend Tracker does NOT work when I use Greasmonky but perfectly working when I use it in Scriptish!


Robert

Reply all
Reply to author
Forward
0 new messages