Click here to Skip to main content
15,881,455 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Good morning people.
I'm having a little problem. I'm working with two servers, IIS and Tomcat. On the IIS server I have an Iframe that shows the pages that are on the Tomcat server.

The big problem is that I can not store data in Tomcat's LocalStorage, which is on port 8080.
How can I send and receive data from port 8080 through port 80 (port to IIS)?

What I have tried:

I've tried the following javascript to send:
localStorage.setItem("pin", "4012");

And this to receive:
var pin = localStorage.getItem("pin");

But this only stores the data in localhost: 80 and not in localhost: 8080.
I still don't know any other way, can you help me?
Posted
Updated 8-Oct-18 23:35pm
v2

1 solution

You can't do this for security reasons. You can only access local items\cookies etc that belong to the same site your code is running on and the port number is a part of that identification so to your browser localhost:80 and localhost:8080 might as well be www.google.com and www.facebook.com, they are not seen as the same site despite the host being the same.

To pre-empt your next question, no there is no way around this.
 
Share this answer
 
Comments
Ayrton Yagami 9-Oct-18 6:04am    
Thanks, but I have to find some way to do it. Is it possible with cookies?
F-ES Sitecore 9-Oct-18 6:11am    
No. Surely it's common sense that one site can't access the client data of a completely different site? If you want to share data you'll need some kind of single sign on arrangement.
Ayrton Yagami 9-Oct-18 6:14am    
Can the concept of CORS help me?
F-ES Sitecore 9-Oct-18 6:35am    
No, that's for making an ajax call to a different site.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900