• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
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.

Cached pictures in iFrame

Scheduled Pinned Locked Moved Troubleshooting
11 Posts 3 Posters 2.8k Views 3 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.
  • B Offline
    BKeyport Module Developer
    last edited by Feb 28, 2021, 11:05 PM

    Here’s the situation. I’m using MMM-iFrame currently (Tried others, same result) to display a PHP generated image. The data behind the image is refreshed approximately every 3-4 hours.

    The two urls I’m using is http://www.hamqsl.com/solarpich.php & http://www.hamqsl.com/solarsystem.php.

    for whatever reason, the images generated within electron on my pi are from the 25th of Feb, which is the first time I used the modules. On other systems, the current image is used which is 28 Feb 2021, 2248GMT.

    Is there any way to turn off the caching, or do whatever I need to do to get a fresh image every time?

    The "E" in "Javascript" stands for "Easy"

    M 1 Reply Last reply Mar 1, 2021, 12:15 AM Reply Quote 0
    • M Offline
      Mykle1 Project Sponsor Module Developer @BKeyport
      last edited by Mar 1, 2021, 12:15 AM

      @bkeyport

      @bkeyport said in Cached pictures in iFrame:

      Is there any way to turn off the caching, or do whatever I need to do to get a fresh image every time?

      Sounds like a similar issue I had a while back. Perhaps this is the same issue. The DOM has to change in order for it to refresh. Sean and Strawberry taught me this. The solution is simple.

      Set up a time stamp var and add it to the end of your img source.

      var getTimeStamp = new Date().getTime();
      img.src = "http://api.usno.navy.mil/imagery/earth.png?view=rise&seed=" + getTimeStamp; 
      

      If yours is the same issue then this will work.

      Hope it helps.

      Peace!

      Create a working config
      How to add modules

      B 1 Reply Last reply Mar 1, 2021, 4:19 AM Reply Quote 1
      • B Offline
        BKeyport Module Developer @Mykle1
        last edited by Mar 1, 2021, 4:19 AM

        @mykle1 The problem is that it’s not my images. The images are provided by a 3rd party. Any changes would have to be on the MM.

        The "E" in "Javascript" stands for "Easy"

        1 Reply Last reply Reply Quote 0
        • S Offline
          sdetweil
          last edited by Mar 1, 2021, 1:01 PM

          @bkeyport the server side doesn’t know you sent this extra parm but it makes the url unique, so fetch thinks it has to get it

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          B 1 Reply Last reply Mar 1, 2021, 7:17 PM Reply Quote 0
          • B Offline
            BKeyport Module Developer @sdetweil
            last edited by Mar 1, 2021, 7:17 PM

            @sdetweil Oh, so I’d be modifying the code to mmm-iframe to add the timestamp?

            The "E" in "Javascript" stands for "Easy"

            S M 2 Replies Last reply Mar 1, 2021, 8:09 PM Reply Quote 0
            • S Offline
              sdetweil @BKeyport
              last edited by Mar 1, 2021, 8:09 PM

              @bkeyport the url into the iframe, where ever the things is would want to change

              url http://someserver/somepath/somefile.img
              over and over the browser say,s OH thats the same, no need to load it, got a copy

              url http://someserver/somepath/somefile.img?time=1
              url http://someserver/somepath/somefile.img?time=2
              url http://someserver/somepath/somefile.img?time=3
              url http://someserver/somepath/somefile.img?time=4

              they are all different, so the browser reloads… the web server gets the extra parm, but doesn’t use it.

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              M 1 Reply Last reply Mar 2, 2021, 1:55 AM Reply Quote 0
              • M Offline
                Mykle1 Project Sponsor Module Developer @sdetweil
                last edited by Mar 2, 2021, 1:55 AM

                @sdetweil

                I thought I said that. :-)

                Create a working config
                How to add modules

                1 Reply Last reply Reply Quote 1
                • M Offline
                  Mykle1 Project Sponsor Module Developer @BKeyport
                  last edited by Mar 2, 2021, 2:12 AM

                  @bkeyport said in Cached pictures in iFrame:

                  Oh, so I’d be modifying the code to mmm-iframe to add the timestamp?

                  I gave you an example bro. :-/

                  Create a working config
                  How to add modules

                  B 1 Reply Last reply Mar 2, 2021, 8:00 PM Reply Quote 0
                  • B Offline
                    BKeyport Module Developer @Mykle1
                    last edited by Mar 2, 2021, 8:00 PM

                    @mykle1 I’m trying to understand how to use the example, bro. 😉

                    Not so good with partial code.

                    The "E" in "Javascript" stands for "Easy"

                    B M 2 Replies Last reply Mar 2, 2021, 11:37 PM Reply Quote 0
                    • B Offline
                      BKeyport Module Developer @BKeyport
                      last edited by Mar 2, 2021, 11:37 PM

                      Got it working guys, thanks for your help, I’ve created a merge request with Mr. Wong as well.

                      If anyone else runs across the thread, and it’s still not merged, my code mods are:

                      https://github.com/BKeyport/MMM-iFrame

                      The "E" in "Javascript" stands for "Easy"

                      1 Reply Last reply Reply Quote 1
                      • 1
                      • 2
                      • 1 / 2
                      1 / 2
                      • First post
                        7/11
                        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