Say there is a site foo.com
which loads JavaScript from site bar.com
. Now, say the JavaScript from site bar.com
tries to read cookies usin
But it turns out that the JavaScript from the site bar.com can only access cookies set by bar.com and not any other.
That isn't true. What matters is where the HTML document containing the element is, not the URL of the JS file that said
mentions in the src attribute.
I suspect your problem is that you are accessing document.cookies
when the property is called document.cookie
(Singular!)