I have a web page on http://localhost/mySite/Page1.aspx that contains an iframe with src https://localhost/mySite/Page2.aspx.
Inside iframe page (Page2.aspx), i set cookie with JavaScript. How i can read that cookie on parent page (Page1.aspx)??? It looks like Page1 not sees the cookie that Page2 sets.
To set/read cookies, I use jQuery.Cookie plugin:
$.cookie('myKey', JSON.stringify(data), { expires: 1, path: '/', domain: 'localhost' });
BTW, if someone can give me an idea how to transfer data on client in such scheme, i will glad to know about it (Server pooling not a solution for me).
I found it works with sessionStorage / localStorage, but it works only in IE 🙁
Based on the question’s comments:
The issue is due to the Same Origin Policy (SOP), which forbids contents of different sources from interfering with one another. different sources is not only based on the comparison of domains, it is also based on the protocol in use as it is clearly shown on this Wikipedia page. Thus,
http://localhostis a different origin tohttps://localhost.In order to make these two sources able to communicate:
window.postMessage()and theonMessageeventThere are also free pre-built solutions (which I didn’t tested though), like Ternarylabs’ Porthole or EasyXDM.
Cheers!