Suppose you have two domains e.g. domain1.com and domain2.com and you want the local storage data to be shareable between those two sites then following this tutorial you will be able to achieve that behavior.
Step by Step Guide: Video Tutorial
You can go through the step by step guide to implement this demo. After this tutorial you will be able to access the local storage across two different domains so you can get, set and delete the local storage values across the domains.
- Clone the GitHub repo
- Then run following command to install the dependecies
npm install
- To run website1, execute following commands, it will run the website on port may be 3000
npm start
- To run website2, execute following commands in a separate terminal, it will run the website on next available port may be 3001
npm start
- The code handles port 3000 and 3001 by default, if you get different port numbers then please replace the port numbers used in codebase with your website port numbers
MIT