Snoopy Snoopy - 1 year ago 111
Javascript Question

How read cookies by jsonp?

Hi I have this code that load a page from index.html:

<script src=""></script>
function jsonCallback(json){

url: "",
dataType: "jsonp"

I want get cookies, so in I've executed in Console:
and return undefined. Why? How can I fix it?

Here's what that URL returns:

"siteName": "SitePoint",
"domainName": "",
"description": "SitePoint is a hub for web developers to share their passion for building incredible Internet things."
"siteName": "A List Apart",
"domainName": "",
"description": "A List Apart explores the design, development, and meaning of web content, with a special focus on web standards and best practices."
"siteName": "Smashing Magazine",
"domainName": "",
"description": "Smashing Magazine delivers useful and innovative information to Web designers and developers."

Answer Source

You can't use JavaScript code in your page to read cookies for other origins. If you have and in it you load a script (which is what you're doing with JSONP) from, any cookies returned with the response from are associated with You can't read them with JavaScript code in

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download