javascript - cookie not being sent when requesting JS -


question originally posted on webmasters, recommended move here.

i host webservice, , provide members javascript bookmarklet, loads js sript server. however, clients must logged in, in order receive js script. works everybody. however, users on setups (i.e. browser/os) known work other people have following problem: when request script via javascript bookmarklet server, cookie server not included request, , such "not authenticated".

i'm making request in following way:

var myscript = eltcreate('script'); myscript.setattribute('src','http://myserver.com/script'); document.body.appendchild(myscript); 

in fit of confused desperation, changed script page output "my cookie has [x] elements" [x] count($_cookie) on http://myserver.example.com. if subset of users requests script using above method encoded in bookmarklet, message reads "my cookie has 0 elements". when access url directly in browser, message reads "my cookie has 7 elements".

what on earth going on?! , more importantly, how fix this?

i'm pretty sure privacy setting issue. affected browsers have increased privacy settings refusing 3rd party scripts setting cookies.

i've experience similar issues when placing iframe pointing domain b on site hosted on domain a. browsers refused iframe set cookies it's own domain because triggered privacy issue.

you might want store hash in script src attribute , have authenticate users way.

edit: sort of i'm talking about: setting cross-domain cookies in safari


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -