Autorefresh iFrame in a CorePro user panel
Scope
Pathfinder CorePro user panels have the capability to display iFrames, which can show content from external websites.
If the content on the external website does not update dynamically, you might want to automatically refresh the iFrame.
This help document will guide you through the steps to add logic that automatically reloads the iFrame content after a specified period of time.
Step by Step
Part1 - Enable Binding for iFrame src property
- Select the iFrame component on the user panel. On the property table click the Blue binding icon next to the src property
- Save the changes to the panel
Part 2 - Create the page reload timer
- Go to the Timers page
- On the Timers tab, select the + icon at the lower right side of the list to create a new timer
- Set the Timer Type as Interval
- Set the Interval value to equal how often you would want the iFrame to reload (in ms)
- Set Autoreset to True
- Set Enabled to True
- Click Appy
Part 3- Create logic flow for page reload
- Go to the Logic Flows page
For best practice, make a new Logic Flow folder to store this logic inside |
|
|
|
|
The final result will be a logic flow that looks similar to this: |
Test it out
Load the user panel and observe that the iFrame content will now reload every 10 seconds (or however long your interval timer was set to)
How it works:
The interval timer's "Elapsed" property will normally be False. When the timer duration elapses, the Elapsed property will briefly become "True" and then go back to "False" when the timer automatically resets
We use the False state of the timer to set the iFrame SRC to the desired page.
We use the True state of the timer to momentary clear the iFrame SRC. So that the iFrame SRC will load fresh, when the Elapsed property once again goes back to the resting False state
Its not perfect, and some pages might not load as expected. Some sites will rate limit you if you are making constant requests too frequently, so use this with care. Ideally this is pointed to something like a local web server that might have static content that updates every so often.
Let us know how we can help
If you have further questions on this topic or have ideas about improving this document, please contact us.