6 examples of 'document .location.href' in JavaScript

Every line of 'document .location.href' 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.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
86getDocumentUrl() {
87 const { node, baseUrl } = this.props;
88 if (this.isExternal) {
89 return '';
90 } else if (this.isAbsolute) {
91 return node.href;
92 }
93
94 let url = `${baseUrl}/${node.href}`;
95 if (!/\.md$/.test(url)) {
96 url += '.md';
97 }
98 return url;
99}
264get URL() {
265 if (this.defaultView) return this.defaultView.location.href;
266
267 return '';
268}
76function createHref(location) {
77 return history.createHref(resolveLocation(location));
78}
32function getLocation( href ) {
33 if ( document ) {
34 const a = document.createElement( "a" );
35 a.href = href;
36 return a;
37 } else {
38 const match = href.match(/^(https?\:)\/\/(([^:\/?#]*)(?:\:([0-9]+))?)([\/]{0,1}[^?#]*)(\?[^#]*|)(#.*|)$/);
39 return match && {
40 href : href,
41 protocol: match[1],
42 host : match[2],
43 hostname: match[3],
44 port : match[4],
45 pathname: match[5],
46 search : match[6],
47 hash : match[7]
48 }
49 }
50}
389set location(href) {
390 this.$_location.href = href
391}
182function createHref(location) {
183 return createPath(location);
184}

Related snippets