Failed to access cookies set by another domain in IE

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

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

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

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

But he returns me zero.
Please help me on this.

+5
source share
5 answers

This is by design. You can only get the cookie value that was set in the current domain.

What you ask for is not possible due to security measures built into web browsers.

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

+9
source

cookie, .

+3

: cookie

, . domain.com , domain1.com , -.

+3

, null, cookie . .

, , cookie -. cookie JS , - ( ) . , . , , , , , blackhat, - voila - , -. , , - ... . !

- , !

+2

, - SOP ( ).

, postMessage, JSONP, xmlHttpRequest iframe, .

. . .

0

All Articles