Answers for "html validate url"

13

url validator javascript

function validURL(str) {
  var pattern = new RegExp('^(https?:\\/\\/)?'+ // protocol
    '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|'+ // domain name
    '((\\d{1,3}\\.){3}\\d{1,3}))'+ // OR ip (v4) address
    '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+ // port and path
    '(\\?[;&a-z\\d%_.~+=-]*)?'+ // query string
    '(\\#[-a-z\\d_]*)?$','i'); // fragment locator
  return !!pattern.test(str);
}
Posted by: Guest on June-04-2020
0

to ensure user input is a link in html

<form action="../../form-result.php" method="post" target="_blank">
  <p>
    Website: <input type="url" name="website" placeholder="Do you have a website?">
    <input type="submit" value="Send data">
  </p>
</form>
Posted by: Guest on January-18-2021
-1

validate url javascript

validateurl
Posted by: Guest on May-19-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language