Home  >  Q&A  >  body text

css - Can javascript prevent Safari from swiping right from the left edge to return? Is there any other way?

There is no Android back button on iOS, so you can go back by swiping right on the left edge. But now I want to disable this function in Safari, is it possible? That means the user can only go down step by step and cannot go back. After searching on Baidu, I found that they are all native iOS solutions. So can the web front-end use JavaScript to implement this function?

滿天的星座滿天的星座2712 days ago804

reply all(4)I'll reply

  • 高洛峰

    高洛峰2017-05-16 13:38:16

    Unable to achieve.

    reply
    0
  • 阿神

    阿神2017-05-16 13:38:16

    After searching Google, there is no solution. You can consider using a single-page application to avoid this problem

    reply
    0
  • 滿天的星座

    滿天的星座2017-05-16 13:38:16

    Based on my understanding, I propose two methods, I don’t know if they will be useful to you
    1. Each time the page is loaded, replace the referrer with the current URL or a fixed homepage URL, so that clicking return will stay on the current page or return directly to the homepage;
    2. If the page is not too complicated, it can be made into one page, so that no matter how many next steps there are, they are all on the same page, and clicking return will return to the first page;
    If you find a more effective way to reply I’ll be fine soon

    reply
    0
  • 習慣沉默

    習慣沉默2017-05-16 13:38:16

    You can try history to operate the browser’s history

    Change the current page to the next page you want, so you won’t be able to return to the previous page.

    reply
    0
  • Cancelreply