views:

172

answers:

1

I have a site on domainA.com. It includes file.js from domainB.com:

<script type="text/javascript" src="http://www.domainB.com/file.js"&gt;&lt;/script&gt;

In file.js, I want to be able to set a cookie for domainA.com. How would I do this? It must be possible since Google Analytics does it for their __utma, etc. cookies.

A: 

I'm an idiot--apparently, this isn't actually a cross domain cookie and you can set it using document.cookie='blah'.

Sam Lee
I believe when you include an external script directly in the page via a `<script>` tag it is loaded in the security context of the page. This is the crux of why jsonp can be used for cross-domain communication.
McKAMEY