Run Home Assistant in an iframe


I have a problem with running HA in an iframe, that I can’t solve with Google, so I would like to try the power of local community :slight_smile:

I have a perfectly working HA instance on my domain via nginx https reverse proxy - something like I also have my own simple web application, that I’m using as a simple catalog of my own home services - HA is one of them. And in this simple web application, I’m showing my home services in an iframe. Till the last week, HA was perfectly working in the iframe, but now, I get Uncaught DOMException: Blocked a frame with origin "" from accessing a cross-origin frame. I was suspecting some HA update, but downgrade works the same, so my new main suspect is the new Chrome version with some stricter CORS policy. It don’t work in Firefox too with similar error message Uncaught DOMException: Permission denied to access property "addEventListener" on cross-origin object.... I tried to add CORS header to nginx proxy add_header Access-Control-Allow-Origin *; - but it didn’t help and now, I don’t know what to try next.

I will be glad for any hint :slight_smile:


This is a known issue, I have this problem too.

Thanks for the link, it saved my time :slight_smile:

FYI: the 2021.6 update solves the iFrame problem!

Great news! Thanks.

i thought i add a bit of what i did to this thread so someone in the future can take advantage. I manage at least 4 instances of Home Assistant and i wanted to have them all show in one page. I used iFrames for that, thanks to ChatGPT :slight_smile:

here’s how it looks:

here’s the code that works (not in chrome if the index.html is stored on your computer, i might move to a self-hosted later and will let you know if it works or not on chrome):

<!DOCTYPE html>
<html lang="en">

    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Home Assistant</title>
        html {
            margin: 0;
            padding: 0;
            height: 100%;
            border: 0;

        .controls {
            padding: 10px;
            background-color: #f0f0f0;
            text-align: center; /* Center the contents */

        .box-container {
            display: flex;
            height: calc(100% - 40px); /* Adjusting for controls height */

        .box {
            flex: 0; /* Initially hidden */
            height: 100%;
            overflow: hidden;

        .visible {
            flex: 1;

        iframe {
            width: 100%;
            height: 100%;

    <div class="controls">
        <label><input type="checkbox" onclick="toggleBox(0)" checked><a href="" target="_blank">HA 1</a></label>
        <label><input type="checkbox" onclick="toggleBox(1)" checked><a href="" target="_blank">HA 2</a></label>
        <label><input type="checkbox" onclick="toggleBox(2)" checked><a href="" target="_blank">HA 3</a></label>
        <label><input type="checkbox" onclick="toggleBox(3)" checked><a href="" target="_blank">HA 4</a></label>
    <div class="box-container">
        <div class="box visible" id="box0"><iframe src=""></iframe></div>
        <div class="box visible" id="box1"><iframe src=""></iframe></div>
        <div class="box visible" id="box2"><iframe src=""></iframe></div>
        <div class="box visible" id="box3"><iframe src=""></iframe></div>

        var urls = [

        function toggleBox(index) {
            var box = document.getElementById('box' + index);
            if (box.classList.contains('visible')) {
                box.innerHTML = '';
            } else {
                box.innerHTML = '<iframe src="' + urls[index] + '"></iframe>';