Because iPad/iPhone doesn't support cookies from third party sites, I want to store values in localStorage. An example on domainA might be:
<script src="http://domainB/something.js"></script>
this script on domainB can access window.localStorage and it works great. However the values are stored in domainA because that's the document's location.
If I put my script inside an iframe whose source is on domainB, then it works, but I'm trying to avoid frames. So my question is: Is there a way to get/set values in localStorage on a remote domain such that they'll be there when I visit domainB at a later time?
This isn't possible without your iframe workaround.
The ability to access the same localStorage object from multiple domains would violate the Same origin policy,and the spec:
User agents must raise a SECURITY_ERR
exception whenever any of the members
of a Storage object originally
returned by the localStorage attribute
are accessed by scripts whose
effective script origin is not the
same as the origin of the Document of
the Window object on which the
localStorage attribute was accessed.
http://dev.w3.org/html5/webstorage/#security-localStorage
If this wasn't for iPhone, I would suggest a flash solution. But with localStorage, I think you are out of luck until they implement a cross-domain policy.