iOS 7 - is there a way to disable the swipe back and forward functionality in Safari?

后端 未结 3 1199
执笔经年
执笔经年 2020-12-01 04:01

For some web pages we use the swipe left and right functionality of iPhone to pull up the menus. Now with iOS7, they have introduced the ability to go back and forward to p

3条回答
  •  误落风尘
    2020-12-01 04:33

    I had to use 2 approaches:

    1) CSS only fix for Chrome/Firefox

    html, body {
        overscroll-behavior-x: none;
    }
    

    2) JavaScript fix for Safari

    if (window.safari) {
        history.pushState(null, null, location.href);
        window.onpopstate = function(event) {
            history.go(1);
        };
    }
    

    Over time, Safari will implement overscroll-behavior-x and we'll be able to remove the JS hack

提交回复
热议问题