Answers for "check to see if the url is valid or not in js"

-1

javascript determine if string is valid url

function isValidHttpUrl(string) {
  let url;
  
  try {
    url = new URL(string);
  } catch (_) {
    return false;  
  }

  return url.protocol === "http:" || url.protocol === "https:";
}
Posted by: Guest on February-05-2021
-1

validate url in javascript

validate url
Posted by: Guest on May-19-2021

Code answers related to "check to see if the url is valid or not in js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language