javascript get url
var currentURL = $(location).attr('href'); //jQuery solution
var currentURL = window.location.href; // raw javascriptvar currentUrl = window.location.href;var currentLocation = window.location;console.log(window.location.origin);window.location.hostnameconst isAbsoluteUrl = url => /^[a-z][a-z0-9+.-]*:/.test(url);
// Example
isAbsoluteUrl('https://1loc.dev'); // true
isAbsoluteUrl('https://1loc.dev/foo/bar'); // true
isAbsoluteUrl('1loc.dev'); // false
isAbsoluteUrl('//1loc.dev');
Also in JavaScript:
- how to load localt ext file in js
- javascript scroll to bottom of div
- js window resize listener
- jest simulate toggle switch react native
- javascript detect textarea change
- simple counter react
- javascript innertext vs innerhtml
- node js interview questions
- how to get value of button that click on it jquery
- jquery count selected options
- run javascript sublime text 3
- node js find directory change directory
- JavaScript banner
- vue v-for object
- javascript string replace
- js export multiple functions
- datatables clear table
- how to pass a value to a react funtion without immediately firing it
- jquery autocomplete database
- append to top javascript
- javascript detect touch screen device
- how to delay something in javascript
- javascript tostring
- javascript create svg