Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] iframe widget doesn't reload #1571

Open
5 tasks done
zaromarco opened this issue May 6, 2024 · 4 comments
Open
5 tasks done

[BUG] iframe widget doesn't reload #1571

zaromarco opened this issue May 6, 2024 · 4 comments
Assignees
Labels
🐛 Bug [ISSUE] Ticket describing something that isn't working

Comments

@zaromarco
Copy link

Environment

Self-Hosted (Docker)

System

No response

Version

latest

Describe the problem

hi , i have setup an ifram widget like this:

name: Speedtest
widgets:
    type: iframe
    updateInterval: 1800
    options:
    url: http://192.168.10.148/speedtest.html
    frameHeight: 260
    id: 0_2993_iframe
    displayData:
    sortBy: default
    rows: 2
    cols: 1
    collapsed: false
    hideForGuests: false

as you can see i have setup the parameter to autoreload the html page each 1800 seconds but the page is not updated...the only way to see the change is to close the dashy board or right click on that iframe and hit reload this sub page...
i'm using the latest firefox.
please let me know

Additional info

No response

Please tick the boxes

@zaromarco zaromarco added the 🐛 Bug [ISSUE] Ticket describing something that isn't working label May 6, 2024
@zaromarco zaromarco changed the title [BUG] iframe wdiget doesn't reload [BUG] iframe widget doesn't reload May 6, 2024
@tradexsrl
Copy link

any news ?
i do an html test page and an iframe inside of it and in a normal html page adding the tag: in the iframe it reload the iframe page.

page.htm

<script>document.write(Date().toString());</script>
<iframe src="frame.htm" title="frame title"></iframe>

iframe.htm

<script>document.write(Date().toString());</script>

with dashy will it works?

@liss-bot liss-bot added the 👤 Awaiting Maintainer Response [ISSUE] Response from repo author is pending label May 7, 2024
@Lissy93
Copy link
Owner

Lissy93 commented May 11, 2024

Have submitted in 07dbccc, and I'll try and get a PR open for this sometime this weekend.

Solution

I got it working, with something like this:

const iframe = document.getElementById(this.frameId);
iframe.contentWindow.location.href = this.frameUrl;
iframe.contentWindow.location.reload(true);

With the frameUrl having an extra val appended to it on each reload

  data: () => ({
    updateCount: 0,
  }),
  computed: {
    /* Generate a URL param, to be updated in order to re-fetch image */
    updatePathParam() {
      return this.updateCount ? `#dashy-update-${this.updateCount}` : '';
    },
    /* Gets users specified URL to load into the iframe */
    frameUrl() {
      return `${this.options.url}${this.updatePathParam}`;
    },
}

@liss-bot liss-bot removed the 👤 Awaiting Maintainer Response [ISSUE] Response from repo author is pending label May 11, 2024
@zaromarco
Copy link
Author

Hi, I bypass the problem by adding this code in the iframed html page

@liss-bot liss-bot added the 👤 Awaiting Maintainer Response [ISSUE] Response from repo author is pending label May 11, 2024
@zaromarco
Copy link
Author

Because the updateInterval in the widget section , as described in your docs doesn't work

@liss-bot liss-bot removed the 👤 Awaiting Maintainer Response [ISSUE] Response from repo author is pending label May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug [ISSUE] Ticket describing something that isn't working
Projects
Status: Awaiting Triage
Development

No branches or pull requests

4 participants