2

With a recent change in Chrome 60, window.navigator.vibrate returns false in cross-origin i-frames, and doesn't vibrate until a user gesture is executed in that window. Is there a way to attach a listener to a window to see when this feature is enabled so I can just avoid calling vibrate until this permission is allowed?

Currently if you try running the function, it will spit out an error in the console and constantly do so until you interact with the window.

An example of the output that's printed to console that I want to avoid:

[Intervention] Blocked call to navigator.vibrate because user hasn't tapped on the frame or any embedded frame yet: https://www.chromestatus.com/feature/5644273861001216

jacob
  • 4,656
  • 1
  • 23
  • 32
  • 1
    https://stackoverflow.com/questions/32653510/feature-detect-if-user-gesture-is-needed – Josh Lee Oct 30 '17 at 22:46
  • @JoshLee Very interesting, so I wouldn't even be attaching the video element to the DOM, just use it for the sake it has a promise that will tell me when I am able to start calling `vibrate`? – jacob Oct 30 '17 at 22:52
  • @JoshLee Actually; this doesn't appear to indicate at all when the user gesture was applied at all, which was my question. – jacob Oct 30 '17 at 23:40

0 Answers0