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
|
|
|
|
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access