I am trying to store data with a unique ID into the browser's storage, from say a.com
using jStorage and jQuery. I am then trying to read the data using the unique ID from, say b.com
. But jStorage.get('UniqueID')
is not working, and it's not showing the desired output.
Can anyone help me with reading browser storage cross-domain?
Now problem was there is as per www protocol cookies and session information is not directly available between subdomain and cross domain as per privacy of data. So, www.example.com and customer.example.com even they belong to same domain example.com they can't read each other cookie information or local storage.
As for now, standard HTML5 Web Storage (a.k.a Local Storage) doesn't now allow cross domain data sharing. This may be a big problem in an organization which have a lot of sub domains and wants to share client data between them.
Having LocalStorage available per domain prevents malicious JavaScript hosted on other websites from manipulating or reading our client data that's used by our domain. Each domain can store up to 5MB of data in LocalStorage. Also, our data isn't sent to the server when an HTTP request is made. Data in LocalStorage has no expiration time.
That’s possible with using 3rd party domain to store global encrypted session information and cross domain communication mechanism. For storage we can use either cookies and html5 localStorage and for communication we will look at using postMessage.
This article has some information related to cross-domain storage. It offers "the basic technique of using an iframe to access another domain's localStorage
object."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With