<!DOCTYPE html>
<html>
<head>
<title>Vibration Button</title>
</head>
<body>
<button id="vibrateButton">Vibrate</button>
<script>
// Function to trigger vibration
function vibratePhone() {
if ("vibrate" in navigator) {
// Vibrate for 1000 milliseconds (1 second)
navigator.vibrate(1000);
} else {
console.log("Vibration API not supported");
}
}
// Attach the vibratePhone function to the button click event
document.getElementById("vibrateButton").addEventListener("click", vibratePhone);
</script>
</body>
</html>