get vibrate() to work in browser without PhoneGap

user1207504 picture user1207504 · Feb 13, 2012 · Viewed 7.7k times · Source

Does anybody know how to get something like navigator.vibrate() to work directly in the browser on a website (without using PhoneGap and the webview)? None of the commands found on http://www.w3.org/TR/vibration/ seem to work and all I could find are references to these commands working using PhoneGap. I have tried this fiddle here:

http://jsfiddle.net/robnyman/BrFvC/

but no joy! :-(

I am running Android 2.3, native browser, Firefox 10 and Maxthon 2.4.5 on an HTC Sensation XE. Does anybody know of a browser that supports this method (already)?

Answer

MunsterMan picture MunsterMan · Aug 23, 2014

Using Javascript:

navigator.vibrate(pattern);

example:

navigator.vibrate(250);

where 250 = 250 ms vibrate.

But - this is not fully supported across all browsers (Namely not by Safari). Check Browser Support for Reference: http://caniuse.com/#feat=vibration