in reply to Re: How can I tell a browser to refresh from perl?
in thread How can I tell a browser to refresh from perl?

As the third sentence of my original post says, I know that I can have the browser periodically refresh. This is not what I'm looking for. The browser will refresh every N seconds (N=60 in your case, meaning a long wait from when the file updates to when we see it) with a flicker, but the file updates only every few minutes. I don't want the browser to poll, I want to tell the browser when it's time.
  • Comment on Re^2: How can I tell a browser to refresh from perl?

Replies are listed 'Best First'.
Re^3: How can I tell a browser to refresh from perl?
by LanX (Saint) on Feb 11, 2017 at 11:22 UTC
    > As the third sentence of my original post says,

    And as another sentence said

    >  Is there a better way to do it? 

    JS doesn't spawn a process and doesn't depend on AppleScript or OS or browser at all.

    You can also use JS in a hidden iframe checking in short frequency if something changed, before conditionally reloading the parent frame. (Hence no "flickering")

    But that's becoming OT here, Google is your friend.

    I know newer technologies like WebSockets allow to push content, but IIRC this will need a server keeping the connection alive.

    See http://en.wikipedia.org/wiki/Push_technology for various options

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Je suis Charlie!

      No flicker for me.

      page.html

      <iframe src="loader.html" style='display:none' > </iframe> <h1>parent</h1> <script> var version=9; document.writeln("Version "+version+" loaded at "+ Date()); </script>
      loader.html
      <h3>loader</h3> <script> setTimeout( function () { window.location.reload(true) }, 1000); var date=Date(); var version=9; document.writeln(date); if (parent.version<version){ parent.location.reload(true); } </script>

      Though in the next step,I would try to get rid of the version number in the source and try to put the load state into the #searchstring

      YMMV

      Cheers Rolf
      (addicted to the Perl Programming Language and ☆☆☆☆ :)
      Je suis Charlie!

      update

      Works with FF and IE.

      For local files not with Chrome, because of same origin policy with file:// protocol

      Possible Workarounds:

    • change security settings

      Is also creating flicker in Chrome tab bar

      Possible Workarounds:

    • use AJAX XML-HTTP-request request instead of iframe