javascript get current url

Today, We want to share with you javascript get current url.In this post we will show you javascript get domain from url, hear for java script get current url without query string we will give you demo and example for implement.In this post, we will learn about Simple Java Script Get Current Url with an example.

javascript get current url without parameters

Use the window.location.href Property





Get Current URL in Java Script - www.pakainfo.com


    
     
    


How to get the current URL using JavaScript ?

 
 

 
	 
 

 
	

Pakainfo.com

JavaScript: Simple Example to get the Online website URL ?

Trigger on Below Button To Get Current URL

Example : 1 JavaScript Window Location

document.getElementById("example_webpage").innerHTML =
"Your System Page location is " + window.location.href;

Example : 2 Window Location Hostname

document.getElementById("example_webpage").innerHTML =
"Your System Page hostname is " + window.location.hostname;

Example : 3 Window Location Pathname

document.getElementById("example_webpage").innerHTML =
"Your System Page path is " + window.location.pathname;

Example : 4 Window Location Protocol

document.getElementById("example_webpage").innerHTML =
"Your System Page protocol is " + window.location.protocol;

Example : 5 Window Location Port

document.getElementById("example_webpage").innerHTML =
"Your System Port number is " + window.location.port;

I hope you get an idea about java script get url path.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment