HTML script for SSL Lookup

Created on 3 July, 2024 • 77 views • 1 minutes read

HTML script for SSL Lookup

<!DOCTYPE html>

<html>

<head>

 <title>SSL Lookup Tool</title>

</head>

<body>

 <h1>SSL Lookup Tool</h1>

 <p>Enter a domain name to check its SSL certificate status:</p>

 <form id="ssl-form">

  <label for="domain">Domain:</label>

  <input type="text" id="domain" name="domain" required>

  <button type="submit">Check SSL</button>

 </form>

 <div id="result"></div>


 <script>

  const form = document.getElementById('ssl-form');

  const resultDiv = document.getElementById('result');


  form.addEventListener('submit', (event) => {

   event.preventDefault();

   const domain = document.getElementById('domain').value;


   // Send the domain name to your server-side script using an API call (e.g., fetch)

   fetch('/api/check-ssl', {

    method: 'POST',

    body: JSON.stringify({ domain }),

   })

   .then(response => response.json())

   .then(data => {

    resultDiv.innerHTML = data.message; // Update the result div with the response message

   })

   .catch(error => {

    console.error(error);

    resultDiv.innerHTML = 'An error occurred. Please try again later.';

   });

  });

 </script>

</body>

</html>