Skip to main content

How to access a variable in an iframe from parent?

You can use:

var myVar = document.getElementById("iframeid").contentWindow.myVar;

Make sure the domains match and that you're using a web server (if testing using the file system you'll get a protocol warning).

Hello, my name is Lee and I work as a full-stack web developer specialising in Microsoft ASP.NET technologies. I love using Umbraco and also MANAGED, my own application management software.

Contact me at lee.gunn@secretorange.co.uk

All skills

Contact

Get in touch to talk about your project or just ask me a question.

lee.gunn@secretorange.co.uk