Every line of 'javascript validate url' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
15 function validateUrl(url) 16 { 17 var p = /^(?:http:\/\/|https:\/\/)/; 18 return (url.match(p)) ? true : false; 19 };
1 function ValidURL(str) { 2 var regex = /(http|https):\/\/(\w+:{0,1}\w*)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%!\-\/]))?/; 3 if(!regex .test(str)) { 4 alert("Please enter valid URL."); 5 return false; 6 } else { 7 return true; 8 } 9 }
75 function _validateURL(url) { 76 const res = url.match(/(http(s)?:\/\/.)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/g); 77 return Boolean(res); 78 }
199 function validateUrlObject(url) { 200 if (!url || !url.href) { 201 throw new Error('Parameter is of wrong type: url'); 202 } 203 }
8 function validateUrl(url) { 9 const parsed = URI.parse(url); 10 // Ignore errors, we can tank on. 11 if (parsed.scheme === 'undefined' || parsed.reference === 'relative') { 12 // Probably missing http:// 13 return `http://${url}`; 14 } 15 16 return url; 17 }
39 function validateUrl(url) { 40 if (url.length <= 0 || typeof url !== 'string') { 41 throw Error('A valid URL is required'); 42 } 43 }
7 function isurl(url) 8 { 9 var regexp=/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/; 10 if (!regexp.test(url)) 11 { 12 alert('Incorrect url (e.g. http://www.adevel.com)'); 13 exit; 14 } 15 return true; 16 }
94 validateUrl(url: string) { 95 /** Validate URL input */ 96 if (url) { 97 const r = /(http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/; 98 99 if (r.test(url)) { 100 return url; 101 } else { 102 console.warn('[Disqus]: Invalid URL'); 103 } 104 } 105 /** DISQUS will fallback to "Window.location.href" when URL is undefined */ 106 return undefined; 107 }
61 function validateUrlData(data: ChannelUrlData | null): boolean { 62 return data && typeof data.channelId === "string" && typeof data.parentId === "string" && typeof data.parentOrigin === "string" ; 63 }
3 export function ValidateUrl(control: AbstractControl) { 4 if (!control.value.startsWith('https') || !control.value.includes('.io')) 5 return { validUrl: true }; 6 7 return null; 8 }