Answers for "how to read valid url in javascript new URL()"

0

how to read valid url in javascript new 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 June-09-2021
-1

validate url in javascript

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

validate url javascript

validateurl
Posted by: Guest on May-19-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language