How can I configure a page to auto-refresh from time to time?

How can I configure a page to auto-refresh from time to time?

I would also like this feature.

This would very helpful feature to force refresh a page to activate latest updates.

Hi

This can be done in Javascript:

//Auto refreshing a screen...
$(document).on('knack-scene-render.scene_xxx', function(event, scene) {
  setInterval(function(){ 

		window.location.reload;
		
    }, 30000);
});

This code will refresh scene xxx every 30 seconds.

If you prefer to only update a particular view on the page then you could replace window.location.reload with:

Knack.views["view_yyy"].model.fetch();

Which will refresh view yyy (which need to be within scene xxx).

Hope this helps.

Julian

3 Likes

What if I find this is not working? Possible causes? I have checked my browser settings to ensure that javascripts are not disabled. I have also added the refresh view script on top of the refresh page script. (and yes, I had replaced the xxx with the scene number (19) and yyy with the view appropriate numbers.

Thank you!

Hi Trey

You could look into KTL

They have an auto refresh keyword _ar and you can set different times so _ar=20 would auto refresh the view every 20 seconds you can view more here

And see a video on it here

Craig