Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript get current url

var currentUrl = window.location.href;
Comment

get the current url javascript

window.location.pathname; // Returns path only (/path/example.html)
window.location.href;     // Returns full URL (https://example.com/path/example.html)
window.location.origin;   // Returns base URL (https://example.com)
Comment

get current url javascript

alert(window.location.href);
alert(document.URL);
Comment

Get the current URL with JavaScript?

console.log(window.location.href);

As noted in the comments, the line below works, but it is bugged for Firefox.
document.URL
Comment

how to get the url of a page in javascript

// this gives you just the URL without params
var currentUrlWithoutParams = window.location.href.split("?")[0];
Comment

javascript to get uri

var newURL = window.location.protocol + "//" + window.location.host + "/" + window.location.pathname + window.location.search
Comment

javascript get current url

let location = window.location.href;
Comment

get current location url javascript

// get current location url javascript

var Your_Current_URL = window.location.href;
Comment

get url in javaScript

location.protocol

location.hostname

location.pathname

location.hash

location.href
Comment

get url of website javascript

document.URL
> "http://example.com/page1.html"

document.location.href
> "http://example.com/page1.html"
Comment

Get the current URL with JavaScript?

window.location.href
As noted in the comments, the line below works, but it is bugged for Firefox.

document.URL
Comment

PREVIOUS NEXT
Code Example
Javascript :: put 0 in front of month number javascript 
Javascript :: TypeError: client.guilds.forEach is not a function 
Javascript :: metamask event disconnect 
Javascript :: how to specify max number of character angular mat input 
Javascript :: nested loops js 
Javascript :: js find longest word in string function 
Javascript :: jquery get radio checked value 
Javascript :: split date 
Javascript :: javascript - get the filename and extension from input type=file 
Javascript :: how to set cookies in node js 
Javascript :: regex not contains 
Javascript :: javascript convert character to ascii 
Javascript :: how to control playback speed in javascript 
Javascript :: jquery on click fade out element 
Javascript :: json to list flutter 
Javascript :: factorial in javascript 
Javascript :: part of sting js 
Javascript :: how to fix header on scroll 
Javascript :: history.push with params 
Javascript :: iframe content fetching 
Javascript :: momentTimeZone 
Javascript :: javascript regex check phone number 
Javascript :: js string contains 
Javascript :: javascript format date object to yyyy-mm-dd 
Javascript :: react native text capitalize 
Javascript :: jquery growl cdn 
Javascript :: how to append values to dropdown using jquery 
Javascript :: remove duplicate items from array 
Javascript :: string contains string javascript 
Javascript :: javascript calculate 24 hours ago 
ADD CONTENT
Topic
Content
Source link
Name
8+9 =