• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

The location Object

As mentioned earlier, one of the properties of every window is the location object. This object holds the current URL, including the hostname, path, CGI script arguments, and even the protocol. Table 19.1 shows the properties and methods of the location object.

Table 19.1. The Location Object Contains Information on the Currently Displayed URL
Name What It Does
Properties  
href Contains the entire URL, including all the subparts; for example, http://jim.odonnell.org:80/Que/location.html
protocol Contains the protocol field of the URL, including the first colon; for example, http:
host Contains the hostname and port number; for example, jim.odonnell.org:80
hostname Contains only the hostname; for example, jim.odonnell.org
port Contains the port number; for example, 80
path Contains the path to the actual document; for example, Que/location.html
hash Contains any CGI arguments after the first # in the URL
search Contains any CGI arguments after the first ? in the URL
Method  
assign(string) Sets location.href to the value you specify



PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint