Accidentally refreshing web app


#1

Hi,

With web apps, is there a way to stop an app refreshing (reloading) when swiping down on the screen in Chrome?
I have a jqxgrid, and sometimes when scrolling back up the list, it can be easy to accidentally refresh the app which is annoying.

Thanks


#2

Having just done this myself, I use a global function

 function handleTouch(e) {
    e.preventDefault();
}

and then call this with

 document.addEventListener('touchmove', handleTouch, {passive: false});

When I need to show a dropdown with a list longer than the screen, I use

document.removeEventListener('touchmove', handleTouch, {passive: false});

#3

Thanks.

I tried this with my app and found that it works fine until i scroll on the JqxGrid. After i scroll on it, the app returns to it’s original state (can refresh app by scrolling down).

Is there a way to overcome this?
Thanks.


#4

Well, I am not using JqxGrid, but for a dropdown I call removeEventListener in the ontouchstart event and add it again in the ontouchend event.