Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to access cookies set by another Domain in IE

I am setting the cookie from a local HTML file as below using cookie.js library

$.cookies.set("Demo","Dummy Data");

From another domain I am trying to get the cookie value using below code

alert($.cookies.get("Demo")); 

But it is returning me null.
Please help me on this

like image 933
Exception Avatar asked Dec 08 '11 16:12

Exception


2 Answers

This is by design. You can only get the value of a cookie which was set on the current domain.

What you are asking for is not possible due to the security measures built in to web browsers.

The best alternative is to make a JSONP AJAX request which can cross domains.

like image 196
Rory McCrossan Avatar answered Sep 30 '22 14:09

Rory McCrossan


You can not read a cookie set by another domain.

like image 41
Roger Avatar answered Sep 30 '22 14:09

Roger