How to get current Page URL using JavaScript

Published: 29 January 2017
on channel: Dhruvin Shah
4,719
23

Today we will discuss
how to get current Page URL using JavaScript

To get a current URL
window.location is used in javascript.
If I write window.location in a console
it will return below values.
hash
host
hostname
href
origin
pathname
port
protocol

If my requirement is to get full URL
Then I will write
window.location.href

If my requirement is to get only current page
then I have to write
window.location.pathname

If you have any doubt related this video
Mail me: dhruvinshah16@gmail.com
Facebook:   / learn2all  
Whatsapp: https://goo.gl/forms/nLq3STEmfFzMqTHT2


On this page of the site you can watch the video online How to get current Page URL using JavaScript with a duration of hours minute second in good quality, which was uploaded by the user Dhruvin Shah 29 January 2017, share the link with friends and acquaintances, this video has already been watched 4,719 times on youtube and it was liked by 23 viewers. Enjoy your viewing!