javascript - How to send cookies in an Image() constructor -


i'm injecting image canvas have securely passing cookies request. issue image constructor doesn't seem send cookies request when src set. cookies not accessible through js, sent browser.

var img = new image(); img.setattribute('crossorigin', 'anonymous');  validateurl(originalurl, function (validatedurl) {     img.src = validatedurl; //get fails after happens });  img.onload = function () {    drawimageprop(context, img); } 

if set crossorigin attribute on image, cookies not sent request image. that's how feature written work.

cookies tied specific domain/subdomain (and optionally path within domain). when requesting image, cookies domain image being requested automatically sent image request.

the browser gives javascript access cookies in same origin host web page. so, javascript has no ability read cookies other domain.

so, when request image setting .src property, cookies belong domain of image url sent image request automatically (you don't cause that).


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -