Notification from iFrame? (MMM-Glance and ...?)



  • I have a web page with some button elements. The web page is shown via MMM-iFrameReload. How can I generate a notification from that web page? I would like to use MMM-Glance to temporarily hide another module.



  • @mmmmh far as I know, the page in the iframe does not KNOW its in a frame, vs being in a web browser someplace else… and is boxed in a container that it cannot communicate thru (this would be a HUGE security exposure to let a framed page get to outside the frame)



  • @sdetweil Thanks for the feedback. I thought so. I guess I’ll cook something up with MMM-Remote-Control.



  • OK, for posterity, here’s what I did.

    I used MMM-Remote-Control and created a button element that calls a function that issues a get request. Interestingly, when I put the URL in the button code the request was rejected (no cross-origin request allowed) but when after I put the URL in the function it worked.

    function toggleCal() {
                var myUrl = "http://mypi.local:8080/remote?action=TOGGLE&module=MMM-CalendarExt";
                console.log("getting " + myUrl)
                var xmlHttp = new XMLHttpRequest();
                xmlHttp.open("GET", myUrl, false); // false for synchronous request
                xmlHttp.send(null);
                return xmlHttp.responseText;
            };
    

    The button code gets mangled here. I had to add spaces

    < button onclick="toggleCal()">Calender on/off< /button>