Welcome to TalkGraphics.com
Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16
  1. #11
    Join Date
    Apr 2015
    Location
    Germany
    Posts
    927

    Default Re: Auto Refresh IFRAME (external data source) with Javascript

    Hi Acorn,
    must have misunderstood your concept. It doesn't seem to be as complex as I thought at first. Maybe a simple interval timer would be able to do the job of setting the Iframe src attribute... Can't test this right now, but will do in about a week and post again if the thread is still open.

  2. #12
    Join Date
    Apr 2018
    Location
    Barnes, London
    Posts
    947

    Default Re: Auto Refresh IFRAME (external data source) with Javascript

    Thank you Siran & Acorn,

    Yes, it appears that a simple interval timer works; added an intro image to start too: https://livedata.initiostar.co.uk. You can wait up to 5 mins to see any updates (Google update policy for published docs) and the various exchanges have to be open.

    HTML Code:
    <iframe id="MyIndices" src="https://livedata.initiostar.co.uk start.png" height=200 width=680 scrolling=no "></iframe>
    <script>
    setInterval(
    function myRefresh() {
      document.getElementById("MyIndices").src="https://docs.google.com/spreadsheets/d/e/2PACX-1vSeFi_s6Kjx6WXqEPm53JFEQAlPTZr2jCRFqmfJWOyfy0SeqL6Gh-wbN5DSDQIrhsS47ZFUTXmIABKu/pubhtml";}, 5000);
    </script>
    An alternative solution is just to call the function through onclick as required.

    HTML Code:
    <iframe id="MystaticIndices" src="https://livedata.initiostar.co.uk/start.png"  height=200 width=680 scrolling =no ></iframe>
    <button onclick="myRefresh ()">Refresh</button>
    <script>
    function myRefresh() 
    { document.getElementById("MystaticIndices").src="https://docs.google.com/spreadsheets/d/e/2PACX-1vSeFi_s6Kjx6WXqEPm53JFEQAlPTZr2jCRFqmfJWOyfy0SeqL6Gh-wbN5DSDQIrhsS47ZFUTXmIABKu/pubhtml"; }
    </script>

    Through the Google console though I receive a message "target-densitydpi" is not supported, so my guess is it might not work in Safari? It does work on Android though.

    Thank you both for your help.

    Gary

  3. #13
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,744

    Default Re: Auto Refresh IFRAME (external data source) with Javascript

    Quote Originally Posted by Initiostar View Post
    Thank you Siran & Acorn,
    Thank you both for your help.
    Gary
    Gary, better than I might have achieved; I had been thinking of driving the refresh from the main page but I can see appending after the IFRAME does the job.

    Acorn
    Acorn - installed Xara software: Cloud+/Pro+ and most others back through time (to CC's Artworks). Contact for technical remediation/consultancy for your web designs.
    When we provide assistance, your responses are valuable as they benefit the community. TG Nuggets you might like. Report faults: Xara Cloud+/Pro+/Magix Legacy; Xara KB & Chat

  4. #14
    Join Date
    Aug 2000
    Location
    Harwich, Essex, England
    Posts
    21,895

    Default Re: Auto Refresh IFRAME (external data source) with Javascript

    Hi Gary, is the auto-update 5 seconds or 5 minutes?
    Egg

    Intel i7 - 4790K Quad Core + 16 GB Ram + NVIDIA Geforce GTX 1660 Graphics Card + MSI Optix Mag321 Curv monitor
    + Samsung 970 EVO Plus 500GB SSD + 232 GB SSD + 250 GB SSD portable drive + ISP = BT + Web Hosting = TSO Host

  5. #15
    Join Date
    Apr 2018
    Location
    Barnes, London
    Posts
    947

    Default Re: Auto Refresh IFRAME (external data source) with Javascript

    Hi Egg,

    is the auto-update 5 seconds or 5 minutes?
    Google Sheets auto-publish any changes to a public version of the spreadsheet 5 minutes after any change occurs. I cannot better this, but unless you had the actual spreadsheet open you would not see at what time each change occurs. The javascript function calls the public version of the spreadsheet every 5 seconds to get any changes; in reality a minute would make no real difference.

    This overcomes the original issue that a published sheet does not auto-update when viewed in a browser (without a refresh). In practice though, I think the refresh button option works just as well.

    Gary

  6. #16
    Join Date
    Aug 2000
    Location
    Harwich, Essex, England
    Posts
    21,895

    Default Re: Auto Refresh IFRAME (external data source) with Javascript

    Hi Gary,

    The javascript function calls the public version of the spreadsheet every 5 seconds to get any changes; in reality a minute would make no real difference.
    That's what I was thinking
    Egg

    Intel i7 - 4790K Quad Core + 16 GB Ram + NVIDIA Geforce GTX 1660 Graphics Card + MSI Optix Mag321 Curv monitor
    + Samsung 970 EVO Plus 500GB SSD + 232 GB SSD + 250 GB SSD portable drive + ISP = BT + Web Hosting = TSO Host

 

 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •