HTML code script for a Safe URL checker

Created on 3 July, 2024 • 144 views

HTML code script for a Safe URL checker

<!DOCTYPE html>

<html>

<head>

<title>Safe URL Checker</title>

</head>

<body>


<h1>Safe URL Checker</h1>

<form id="url-form">

 <label for="url">Enter a URL:</label><br>

 <input type="text" id="url" name="url"><br><br>

 <button type="button" onclick="checkURL()">Check URL</button>

</form>


<p id="result"></p>


<script>

function checkURL() {

 var url = document.getElementById("url").value;

 var result = document.getElementById("result");


 if (url.startsWith("https://")) {

  result.innerHTML = "This URL uses HTTPS, a good security sign.";

 } else {

  result.innerHTML = "This URL does not use HTTPS. Be cautious.";

 }


 // You can add additional checks for suspicious characters here.

}

</script>


</body>

</html>