A Timed Button Click Script by Whiz Fayisal

Do not make any changes to the code without first consulting Whiz Fayisal in the YouTube video comments.


<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <style>
    .download-button {
      display: block;
      width: 200px; 
      margin: 20px auto; 
  </style>
</head>
<body>
<a id="downloadLink" href="https://www.facebook.com" class="download-button" target="_blank">
  <img src="https://downloads.intercomcdn.com/i/o/61172035/5f10f55279e847959ed488e5/download.gif" alt="Download">
</a>
<script>
  setTimeout(function() {
    var downloadLink = document.getElementById('downloadLink');
    downloadLink.click();
  }, 3000); // Adjust the delay as needed (in milliseconds)
</script>
</body>
</html>


When you open the page, it displays a download button styled with a width of 200 pixels and centered on the page. 

When you click the button, it opens a new tab to the specified Facebook URL. However, there's an added feature: a timer is set to wait for 3 seconds (adjustable), after which it triggers a click on the download button. This simulates a download action, providing a user-friendly experience.

1 comment: