Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mobile: how to prevent pull-to-refresh

How to prevent pull-to-refresh in web applications for Chrome android?

I tried the answers from

Disabling android's chrome pull-down-to-refresh feature

body {
  overflow-y: hidden;
}

or

body {
  touch-action: none;
}

It did not work. any one has a solution that works? It is very bad for browsers to make pull-to-refresh default behavior, it is very undesirable for web applications.

like image 453
Dave Avatar asked Oct 13 '16 03:10

Dave


1 Answers

Here's a CSS method of capturing the required touch gestures to prevent the pull to refresh:

$("html").css({
    "touch-action": "pan-down"
});

This method seems to have worked well for other users. Hope it works for your needs.

Reference, plus there's more strategies discussed here: Disabling android's chrome pull-down-to-refresh feature

like image 196
Chris J Avatar answered Sep 18 '22 03:09

Chris J