Name
location — NN 2 IE 3 DOM 1
Synopsis
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
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, you can overcome the security restriction with the help
of signed scripts (a topic more suitable for a JavaScript book
covering Navigator 4), but the user still has to give explicit
permission for a script to access location object information outside
the script’s domain.
Object Model Reference
- NN
[
windowRef
.]location
- IE
[
windowRef
.]location
Properties
|
|
|
|
|
|
|
|
Methods
|
|
|
Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.