location.hrefWe can get the full URL of the current page by using location object , Here is the syntax.
Sample code is here.
The output is here
Path of to the script rootWe can get path of the URL upto the root of the page by using slice and lastIndexOf functionHere it is
Output is here
This article is written by plus2net.com team.
![]() | ||
| ||