“alert()” and “confirm()” not working with “apple-mobile-web-app-capable”

前端 未结 7 1135
感动是毒
感动是毒 2021-02-07 02:32

Under iOS (currently 7.0), it looks like alert() and confirm() are not working when our web app is pinned to the home screen (aka using the meta tag

相关标签:
7条回答
  • 2021-02-07 03:18

    I had this happening for me with the following code:

    const confirmation = window.confirm(message || 'Are you sure?');
    

    The confirm would show up on PC (Edge browser), but not on iPhone (Safari browser)

    I changed the code to the following (removed the window.):

    const confirmation = confirm(message || 'Are you sure?');
    

    And suddenly it was working again.

    I am guessing that Apple got its own implementation of confirm that does not need the window.

    0 讨论(0)
提交回复
热议问题