Reputation: 861
I am developing a web application in which my users log in, and are redirected to a third party website, where there is a script tag that loads a script from my domain.
Meaning, if my website is foo.com, then on the third party website, there is a script tag such as:
<script src="http://www.foo.com/script.js"></script>
I wish to access the cookies that I set on my user when they logged in at foo.com
using the script which has been added on the bar.com
website. How can I do this?
Upvotes: 0
Views: 195
Reputation: 943695
JavaScript has no access to cookies from a different origin (and the origin is based on where the HTML document was served from, not the script).
If you want the data, then you will need to include it in the script file (which you could generate programatically; make sure you get the content-type right and beware caching issues)
Upvotes: 1