get vibrate() to work in browser without PhoneGap

孤人 提交于 2019-12-01 20:07:19

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

It depends on the browser, currently I've only found firefox mobile beta to support the vibrate API. You can find an example showing how this works here.

Basically you just have to make the following call:

navigator.mozVibrate(toPlay);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!