0

i am using this code to refresh my page when the browser is resizes. Unfortunately this effects scrolling on mobile devices. The page keeps on reloading when is scroll in my iPhone. Is there a way to exclude mobile devices from this code?

$(window).bind('resize', function(e)
{
  if (window.RT) clearTimeout(window.RT);
  window.RT = setTimeout(function()
  {
    this.location.reload(false); /* false to get page from cache */
  }, 100);
}); 

Thank you!

nwde
  • 47
  • 7
  • .bind is no longer used. Use .on instead - it seems you want to reflow the page when resizing? That can be done without reloading – mplungjan Mar 19 '20 at 13:01
  • I know its quite unusual what im trying to achieve. But I need to work with an old code that calculates padding-values according to the browser-width. So when a visiter resizes his browser-size I need the page to reload. Does reflow achieve that? – nwde Mar 19 '20 at 13:07
  • This solved my issue: https://stackoverflow.com/questions/5836779/how-can-i-refresh-the-screen-on-browser-resize/18321223 – nwde Mar 19 '20 at 14:15
  • Feel free to delete then – mplungjan Mar 19 '20 at 14:27

0 Answers0