javascript's does not use the "replace" flag quite as expected




DOM: Core & HTML
14 years ago
21 days ago


(Reporter: rob, Unassigned)


1.0 Branch
Windows XP

Firefox Tracking Flags

(Not tracked)




14 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.3) Gecko/20040913 Firefox/0.10.1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.3) Gecko/20040913 Firefox/0.10.1

Javascript's function has two parameters. The first is the MIME
type (generally, "text/html") and the second indicates that the content to be
written should *replace* the current/original content of the page in the
browser's history.

Mozilla and Firefox do not completely ignore the 2nd parameter, however they
enter the page as a *new* entry in the history, allowing the user to page back
to the page as it originally was.

As is probably very annoying to mention, it works as expected in IE.

Reproducible: Always
Steps to Reproduce:
1) Page is opened. For ease of explanation of the history, let's say the user
double-clicked an html file on their hard drive and it opened in the browser.
2) The current page is rewritten using JavaScript and as
described above.
3) User navigates to some other page.
4) User clicks back button and sees the *rewritten* page.
Actual Results:  
User is able to click "Back" yet again and see the original page, the way it
looked before rewriting.

Expected Results:  
Back button is disabled, user is at the beginning of history and cannot go back

This is very easy to reproduce. I can send you a standalone test page if desired. is DOM0 -> Core.
Assignee: firefox → general
Component: General → DOM: Level 0
Product: Firefox → Core
QA Contact: general → ian
Version: unspecified → 1.0 Branch
Actually, attaching a simple test case would probably help a bit.  Thanks!
Assignee: general → nobody
QA Contact: ian → general

Move all DOM bugs that haven't been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5

Comment 5

21 days ago
Seems like this has been fixed. The test case in comment #3 (reproduced below, resurrected from is now working as expected.

<TITLE>First Document</TITLE>
function replace(){
    var oNewDoc ="text/html", "replace");
    var sMarkup = "<HTML><HEAD><TITLE>New Document</TITLE><BODY>Hello, world</BODY></HTML>";
<h1>I just want to say</h1><br>
<!--Button will call the replace function and replace the current page with a new one-->
<Input type ="button" value = "Finish Sentence" onclick="replace();">
You need to log in before you can comment on or make changes to this bug.