
This winter, we had a chance to notice such useful news in the mobile Firefox, as the control over the
battery charge and the management of
mobile communications and SMS . The day before yesterday
, the Mozilla Hacks blog posting that the developers of Firefox 11 also provided the sites with an interface that controls the
vibration of a mobile phone.
In the simplest case, it is sufficient to set the duration of the vibration, expressed in milliseconds, using javascript:
navigator.mozVibrate(1000);
A slightly more complicated vibration is set by means of an array, the odd elements of which specify the duration of the vibration, and even-numbered ones - the duration of the subsequent pause. Here is an example of a brief double vibration:
')
navigator.mozVibrate([200, 100, 200, 100]);
To immediately stop the vibration of a mobile phone (without waiting for the end of the specified durations), it is enough to transfer a zero duration or an empty array to the same method:
navigator.mozVibrate(0); navigator.mozVibrate([]);
The draft of the relevant standard is published
on the W3C website .