Every line of 'how to get href value in javascript' 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.
20 export function getLinkUrl(value: Resource | ResourceLinks, ...rels: ReadonlyArray) { 21 if (!value) { 22 return false; 23 } 24 25 const links = value._links || value; 26 27 for (const rel of rels) { 28 const link = links[rel]; 29 30 if (link && link.method && link.href) { 31 return link.href; 32 } 33 } 34 35 return undefined; 36 }
4 get href() { 5 return this.node.source.value; 6 }
21 function looksLikeHref(value) { 22 return !!value.match(/^https?:\/\/[^\/]+\//); 23 }
196 resolveHref(el) { 197 if (!el) { 198 return null; 199 } 200 const closestHrefEl = el.closest('[href]'); 201 return closestHrefEl ? closestHrefEl.getAttribute('href') : null; 202 }
37 function redirectbasehref(el, responseText) { 38 var mo = responseText.match(/
79 static extractIdFromHref(obj) { 80 const attrs = obj.$; 81 82 if (attrs && attrs.href) { 83 const match = attrs.href.match(/\d+$/); 84 85 if (match) { 86 return match[0]; 87 } 88 } 89 90 return ''; 91 }
80 function href(index) { 81 index = index.toLowerCase(); 82 if (HTTP_SPECS.indexOf(index) > -1) { 83 return "https://httpwg.org/specs/" + index + ".html"; 84 } 85 return "https://tools.ietf.org/html/" + unpad(index); 86 }
66 export function getScriptUrl(name: string): string | undefined | null { 67 const scriptElement = 68 document.querySelector(`script[src*='/${name}.min.js']`) || 69 document.querySelector(`script[src='${name}.min.js']`) || 70 document.querySelector(`script[src*='/${name}.js']`) || 71 document.querySelector(`script[src='${name}.js']`); 72 73 if (scriptElement) { 74 return (scriptElement as HTMLScriptElement).src; 75 } else { 76 return undefined; 77 } 78 }
59 protected getHrefAttribute(): string { 60 const { 61 href, 62 to, 63 urlParams, 64 utmCampaign, 65 utmContent, 66 utmMedium, 67 utmSource, 68 utmTerm 69 } = this.props; 70 if ("string" === typeof href) { 71 return href; 72 } 73 if ("undefined" === typeof to) { 74 return "#"; 75 } 76 let urlParamsObject = {}; 77 if ("undefined" !== typeof urlParams) { 78 urlParamsObject = urlParams; 79 } 80 /** 81 * @see https://rockcontent.com/blog/parametros-utm-do-google-analytics/ 82 */ 83 if (utmCampaign || utmContent || utmMedium || utmSource || utmTerm) { 84 urlParamsObject = Object.assign(urlParamsObject, { 85 utm_campaign: utmCampaign, 86 utm_content: utmContent, 87 utm_medium: utmMedium, 88 utm_source: utmSource, 89 utm_term: utmTerm 90 }); 91 } 92 const stringified = stringify(urlParamsObject); 93 return `${to}?${stringified}`; 94 }
52 function getHref(element) { 53 try { 54 return element.href || null; 55 } catch (x) { 56 // IE throws a security exception for urls including username/password: 57 // http://user:password@example.com/ 58 return null; 59 } 60 }