Javascript Reference
Categories: location

javascript location Description

@March 15, 2008, 1:22 a.m.
locationFirefox/Netscape/NN 2 IE 3 Chrome/Safari/DOM n/a  

  

There is one location object in each window or frame. The object stores all information about the URL of the document currently loaded into that window or frame. By assigning a new URL to the href property of the location object, you instruct the browser to load a new page into the window or frame. This is the primary way of scripting the loading of a new page:

location.href = "newPage.html";
 

A script in one frame can reference the location object in another frame to load a new document into that other frame:

parent.otherFrameName.location.href = "newPage.html";
 

Security restrictions prevent a script in one frame from accessing location object information in another frame if the document in the second frame does not come from the same domain (and the same server, unless the document.domain properties of the two documents are set to match) as the document with the nosy script. This prevents a rogue script from monitoring navigation in another frame to external web sites. In Navigator 4 and later, you can overcome the security restriction with the help of signed scripts, but the user still has to give explicit permission for a script to access location object information outside the script's domain.

 

As a window-related object, the location object is not part of the formal W3C DOM Level 1 or 2 specifications (which leave windows for future versions). But the location object and its properties are well-entrenched in scripting vernacular, and should continue to be supported for a long time coming.

 
Object Model Reference
 
[windowRef.]location
 
Object-Specific Properties
 
hashhosthostnamehrefpathnameportprotocolsearch
 
Object-Specific Methods
 
assign( )reload( )replace( )
 
Object-Specific Event Handler Properties

None.

lipitor 20mg canada <a href="https://lipiws.top/">lipitor 40mg over the counter</a> atorvastatin 20mg pill
Txtial - 9 months
Hey there! Do you know if they make any plugins to Schlossman
WilliamWhox - 2016-06-06

Powered by Linode.