JavaScript Current Document Values

The following values allow you to grab useful information about the page you’re viewing such as the current page’s pathname or url.

Complete List of Document Values

self.location.hash       //Sets or retrieves the subsection of the href property that follows the number sign (#). 
self.location.host       //Sets or retrieves the hostname and port number of the location or URL. 
self.location.hostname   //Sets or retrieves the host name part of the location or URL.  
self.location.href       //Sets or retrieves the entire URL as a string.  
self.location.pathname   //Sets or retrieves the path and file name associated with a URL.  
self.location.port       //Sets or retrieves the port number associated with a URL. 
self.location.protocol   //Sets or retrieves the protocol portion of a URL.  
self.location.search     //Sets or retrieves the substring of the href property that follows the question mark

Discover more from Devin.org

Subscribe to get the latest posts sent to your email.

One Comment

Comments are closed.