HTMLify

js3.html
Views: 208 | Author: demo
<!DOCTYPE html>
<html>
<head>
    <title>Auto Vibration on Page Load</title>
</head>
<body>
    <script>
        // Function to trigger vibration on page load
        function autoVibrateOnLoad() {
            if ("vibrate" in navigator) {
                // Vibrate for 1000 milliseconds (1 second) when the page loads
                navigator.vibrate(1000);
            } else {
                console.log("Vibration API not supported");
            }
        }

        // Attach the autoVibrateOnLoad function to the window's load event
autoVibrateOnLoad()
    </script>
</body>
</html>

Comments