1

The alert function does work in iPadOS, but when wrapped in Vue lifecycle methods - it is prevented. Curious to understand why and what is going on.

Simplest example:

<div id="app">
  <h2>Alert</h2>
</div>
new Vue({
  el: "#app",
  created() {
      alert('created')
  },
  mounted() {
      alert('mounted')
  }
})

This on the desktop will throw both alerts. In iPadOS Safari - it will not.

Calling JS with alert without Vue will work on iPadOS/iOS.

https://jsfiddle.net/JackLeo90/g64sou5t/5/

JackLeo
  • 4,579
  • 9
  • 40
  • 66
  • Didn't check but good to know. I'd expect that it treats them the same way as popups because they are potential annoyances. Try to open based on user action, i.e. click. – Estus Flask Oct 25 '21 at 09:48
  • It does work if I embed it to basic js. But Vue does treat it differently. So not sure how much of it is iPadOS/iOS and how much is Vue – JackLeo Oct 25 '21 at 15:33
  • Does work in click listener? Vue is totally unaware of what browser APIs you all, and vice versa. A thing that matters is that Vue app takes some time to initialize, so it's safe to assume that basic js and Vue app run at different time. This can matter if the problem is that an alert that wasn't supposedly caused by user action is blocked – Estus Flask Oct 25 '21 at 18:31

0 Answers0