Availability
JavaScript 1.1
Synopsis
location.replace(url)Arguments
url
A string that specifies the URL of the new document that is to
replace the current one.
Description
The replace(
) method of the Location object loads and displays a new
document. Loading a document in this way is different from simply
setting location or
location.href in one
important respect: the replace( ) method does not
generate a new entry in the History object. When you use
replace( ), the new URL overwrites the current
entry in the History object. After calling replace(
), the browser's Back button does not return you to the
previous URL; it returns you to the URL before that one.
Usage
When you are working with multiple frames and/or JavaScript-generated
documents, you sometimes end up with quite a few temporary documents.
If there are more than just a few of these documents, backing out of
your web site with the Back button
can be annoying. If you use the replace( ) method
to load these documents, however, you can prevent this problem.
See Also
History
•
Table of Contents
•
Index
•
Reviews
•
Examples
•
Reader Reviews
•
Errata
JavaScript: The Definitive Guide, 4th Edition
By
David Flanagan
Publisher
: O'Reilly
Pub Date
: November 2001
ISBN
: 0-596-00048-0
Pages
: 936
Slots
: 1
This fourth edition of the definitive reference to
JavaScript, a scripting language that can be embedded
directly in web pages, covers the latest version of the
language, JavaScript 1.5, as supported by Netscape 6 and
Internet Explorer 6. The book also provides complete
coverage of the W3C DOM standard (Level 1 and Level 2),
while retaining material on the legacy Level 0 DOM for
backward compatibility.