I have multipule files:
default.html
<script src="/js/global.js"></script>
<script src="/js/default.js"></script>
global.js:
var session_id=null;
default.js:
session_id = "stuffs";
console.log(session_id); //works
chatroom.html (iframe in default.html)
<script src="/js/global.js"></script>
<script src="/pages/chatroom/chatroom.js"></script>
chatroom.js:
console.log(session_id);//doesn't work. returns
How can I get access to session_id in chatroom.js? Thanks for any help!
Try the following from within the iframe:
also
window.topshould work if you have many nested iframes: