MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    Does anyone know how to make the iFrame module refresh periodically?

    Scheduled Pinned Locked Moved Solved Troubleshooting
    28 Posts 6 Posters 23.4k Views 6 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C Offline
      cnelso24
      last edited by

      I have a google spreadsheet displayed, but the problem is it only refresh the content when I restart Magic Mirror.

      1 Reply Last reply Reply Quote 0
      • K Offline
        kevsfastz @cnelso24
        last edited by

        @cnelso24

        I have found a fix for this module which I posted here:

        https://github.com/TheBogueRat/MMM-iFrameReload/issues/2

        Kev

        C 2 Replies Last reply Reply Quote 1
        • P Offline
          PeppaPigKilla
          last edited by

          Have a Read here http://stackoverflow.com/questions/5146805/an-iframe-i-need-to-refresh-every-30-seconds-but-not-the-whole-page

          1 Reply Last reply Reply Quote 1
          • C Offline
            cnelso24
            last edited by

            So would I put that code in the iFrame module that I downloaded or in my config.txt. Sorry I’ve barely programmed anything and yesterday was the first time I’ve ever used JavaScript

            1 Reply Last reply Reply Quote 0
            • P Offline
              PeppaPigKilla
              last edited by

              whats the iframe mod you downloaded ?

              C 1 Reply Last reply Reply Quote 0
              • C Offline
                cnelso24 @PeppaPigKilla
                last edited by

                @PeppaPigKilla

                link text

                The one listed on the MagicMirror website

                1 Reply Last reply Reply Quote 0
                • P Offline
                  PeppaPigKilla
                  last edited by PeppaPigKilla

                  on the config part I believe its just the URL. But on the iframe.js file, i think extra code would needed to be added.

                  
                  /* global Module */
                  
                  /* Magic Mirror
                   * Module: iFrame
                   *
                   * By Ben Williams http://desertblade.com
                   * MIT Licensed.
                   */
                  
                  Module.register("iFrame",{
                  		// Default module config.
                  		defaults: {
                  				height:"300px",
                  				width:"100%"
                  		},
                  
                  
                  	// Override dom generator.
                  	getDom: function() {
                  		var iframe = document.createElement("IFRAME");
                  		iframe.style = "border:0"
                  		iframe.width = this.config.width;
                  		iframe.height = this.config.height;
                  		iframe.src =  this.config.url;
                  		return iframe;
                      window.setInterval("reloadIFrame();", 30000);
                  
                  function reloadIFrame() {
                   document.frames["frameNameHere"].location.reload();
                  }
                  	}
                  
                  });
                  
                  C 2 Replies Last reply Reply Quote 0
                  • C Offline
                    cnelso24 @PeppaPigKilla
                    last edited by

                    @PeppaPigKilla

                    Thank you for taking the time to help! Although, I put this into the module code and still no updates after letting it sit for 15 minutes. I also put the

                    1 Reply Last reply Reply Quote 0
                    • C Offline
                      cnelso24 @PeppaPigKilla
                      last edited by

                      @PeppaPigKilla
                      Sorry the forum seems to be overloaded. I put this in my code and still no refreshing. I believe the problem is my iFrame does not have a specified name. I am only able to input the scr=“URL”. Not sure where to put iframe name = “name”. When generating an iFrame from google sheets it does not specify a name either.

                      1 Reply Last reply Reply Quote 0
                      • P Offline
                        PeppaPigKilla
                        last edited by

                        I tried it and cant get it to work either. best reaching out to the author,

                        strawberry 3.141S 1 Reply Last reply Reply Quote 0
                        • strawberry 3.141S Offline
                          strawberry 3.141 Project Sponsor Module Developer @PeppaPigKilla
                          last edited by

                          @PeppaPigKilla the code that was added by you is after the return, so the code will never be reached.

                          I suggest an interval which calls updateDom, which will be created after the DOM_OBJECTS_CREATED broadcast

                          Please create a github issue if you need help, so I can keep track

                          C 1 Reply Last reply Reply Quote 2
                          • C Offline
                            cnelso24 @strawberry 3.141
                            last edited by

                            @strawberry-3.141

                            Thanks for the suggestion. I wouldn’t know where to start with that though. I tried this module which did not work refresh for me either.

                            strawberry 3.141S K 2 Replies Last reply Reply Quote 0
                            • strawberry 3.141S Offline
                              strawberry 3.141 Project Sponsor Module Developer @cnelso24
                              last edited by

                              @cnelso24 the problem is probably that there isnt a change detected when updating the dom, try to add a timestamp attribute to the iframe.

                              Please create a github issue if you need help, so I can keep track

                              1 Reply Last reply Reply Quote 0
                              • K Offline
                                kevsfastz @cnelso24
                                last edited by

                                @cnelso24

                                I have found a fix for this module which I posted here:

                                https://github.com/TheBogueRat/MMM-iFrameReload/issues/2

                                Kev

                                C 2 Replies Last reply Reply Quote 1
                                • C Offline
                                  cnelso24 @kevsfastz
                                  last edited by

                                  @kevsfastz

                                  Thank you!! I will check it out when I get home.

                                  1 Reply Last reply Reply Quote 0
                                  • C Offline
                                    cnelso24 @kevsfastz
                                    last edited by

                                    @kevsfastz

                                    Just got a chance to try this. Works like a charm! Thank you!

                                    1 Reply Last reply Reply Quote 0
                                    • foxF Offline
                                      fox
                                      last edited by

                                      @kevsfastz is it possible to show simple html content and update periodically?

                                      Issues With MMM-WatchDog known?

                                      https://forum.magicmirror.builders/post/29827

                                      Useful for PIR-Sensor: https://forum.magicmirror.builders/post/21299

                                      K 1 Reply Last reply Reply Quote 0
                                      • K Offline
                                        kevsfastz @fox
                                        last edited by

                                        @fox
                                        The simple answer is yes it is possible. What is your goal specifically?

                                        foxF 1 Reply Last reply Reply Quote 0
                                        • Mitch1138M Offline
                                          Mitch1138
                                          last edited by

                                          Many thanks, I have bee looking for a way to do this for some time. I loaded iFrameReload with the following url. It will load, but not update. Any suggestions as to what I am missing?

                                          url: “http://tides.tidegraph.com/api/tidegraph.php?bg=black&scale=.8&station=Old Frenchtown Wharf, Elk River, Maryland”,

                                          Many thanks

                                          K 1 Reply Last reply Reply Quote 0
                                          • K Offline
                                            kevsfastz @Mitch1138
                                            last edited by

                                            @Mitch1138

                                            As mentioned above, I have provided a fix or adjustment by adjusting the MMM-IframeReload.js below:

                                            https://github.com/TheBogueRat/MMM-iFrameReload/issues/2

                                            1 Reply Last reply Reply Quote 0
                                            • Mitch1138M Offline
                                              Mitch1138
                                              last edited by

                                              My mistake, I thought this was updated in the .git. I added the timestamp as you suggested (iframe.src = this.config.url + new Date().getTime();). The url does update now, but since the url displays the tides at a location embedded in the url, it looks like the timestamp is appended to the location. With this added, it is not a valid location and the tides don’t display.

                                              Again, many thanks for your help.

                                              K 1 Reply Last reply Reply Quote 0

                                              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                              With your input, this post could be even better 💗

                                              Register Login
                                              • 1
                                              • 2
                                              • 1 / 2
                                              • First post
                                                Last post
                                              Enjoying MagicMirror? Please consider a donation!
                                              MagicMirror created by Michael Teeuw.
                                              Forum managed by Sam, technical setup by Karsten.
                                              This forum is using NodeBB as its core | Contributors
                                              Contact | Privacy Policy