Closed Bug 291819 Opened 20 years ago Closed 20 years ago

history.go(-1) does'nt work after affect document.getElementById("legende").innerHTML

Categories

(Firefox :: Bookmarks & History, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: michel.roger, Assigned: bugs)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; fr-FR; rv:1.7.7) Gecko/20050414 Firefox/1.0.3
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; fr-FR; rv:1.7.7) Gecko/20050414 Firefox/1.0.3

********** test.html *****************
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

<html>

<head>
<title>Sans Titre</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
</head>
<body bgcolor="#FFFFFF">
first page
<br />
<a href="second.htm">second page </a>
</body>
</html>

********** second.html *************
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>test</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<SCRIPT language="JavaScript">

var tbPhotTxt = new Array();
tbPhotTxt[0] = 'un .' ;
tbPhotTxt[1] = 'deux .' ;
tbPhotTxt[2] = 'trois .' ;
tbPhotTxt[3] = 'quatre .' ;
tbPhotTxt[4] = 'cinq .' ;
tbPhotTxt[5] = 'six .' ;
tbPhotTxt[6] = 'sept .' ;
tbPhotTxt[7] = 'huit .' ;

var j = 0;
var p = tbPhotTxt.length;


function next(){
    if (j < (p-1)){
        j++;
    }
   if(document.getElementById){
        document.getElementById("legende").innerHTML = tbPhotTxt[j] ;
   }

}

</script>
</head>

<body >
<table width="840" border="1"  align="center">
  <tr>
    <td><a href="#" onClick="javascript:history.go(-1);">retour page debut</a></td>
  </tr>
  <tr>
    <td><a href="#" onClick="next();">next</a ></td>
  </tr>
  <tr>
    <td><span id="legende" name="legende">page autre</span></td>
  </tr>
</table>
</body>
</html>


Reproducible: Always

Steps to Reproduce:
1.the first page call the second page.
On this second page a link (history.go(-1) that work correctly go to the first page
2.Now by DHTML you change the inner txt of an other element of this second page
3.You want to return to the first page

Actual Results:  
it's impossible

Expected Results:  
The software have to go to the first page like before clicking on the button next.

Just change an inner txt isn't a new page and if is it, how go back by javascript.



this code work with IE
this code work with histort.go(-2)
the original button of Firefox work correctly
-->invalid
you go to href="#" with the Next link (so it adds a Session History entry), use
href="javascript:next();" instead, then history.go(-1) works.
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
Summary: history.go(-1) does'nt work after affect document.getElementById("legende").innerHTML → history.go(-1) does'nt work after affect document.getElementById("legende").innerHTML
Component: History → Bookmarks & History
QA Contact: mozilla → bookmarks
You need to log in before you can comment on or make changes to this bug.