Closed Bug 274101 Opened 20 years ago Closed 19 years ago

Reload of the page fails - iframe loads wrong way

Categories

(Firefox :: General, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: pachollini, Assigned: bugzilla)

References

()

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0

When I try to reload the page, it fails, because one iframe is loaded instead of
another. The structure of (i)frames is following:

- top
  - map (the iframe containing the map)
    - loader(s) (iframes loading JavaScript data for displaying icons in the map)
  - objekt, seznam and help iframes - IMO unimportant in this case

the "loaders" iframes are added into the "map" iframe via Javascript (after
switching on displaying of icons). when I reload the main page, the loader
iframe is loaded instead of the map iframe (sometimes insted of some other
iframe too).


Reproducible: Always
Steps to Reproduce:
1. go to the URL above
2. wait till the page fully loads (blue "i" icons are displayed)
3. press the reload button of the browser

Actual Results:  
The map doesn't load.

Expected Results:  
Reload whole page including the map.

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8a5) Gecko/20041015 works
fine by me.
WFM Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107
Firefox/1.0
I think I get something related. I created a very simple page like this:

<html>
   <body>
       <p>IFRAME Test</p>
       <iframe name="content" frameborder="1" width="100%" height="400px"
src="http://www.abc.net.au/news/justin"></iframe>
   </body>
</html>

The page loads properly to start with, but if then change the src
attribute in a text editor and then attampt to reload the page,
the content of the iframe does not change.

The about box say I am using : Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US;
rv:1.7.5) Gecko/20041107 Firefox/1.0. My downloaded file date is Jan 6 2005.


I also have an error of the like.

I wrote an application for radiologists to sign transcribed reports where they 
can also make edits through a WYSIWYG Iframe editor. When they sign in, all of 
their available reports are loaded into DIV tags and when one is selected, the 
contents are written to the Iframe.

There are actually a couple problems. The first is more closer to what you 
describe. If a user signs all of the reports on a list and submits the page, 
the page returns back with the contents remaining in the iframe.

The second is that each time a report is clicked, the contents are appended to 
the iframe instead of overwriting. If a user clicks the Refresh button in the 
browser, this does not happen. This error happens occasionally, but there is 
more. In this web application, we discourage the users from using browser 
navigation, but to use the supplied navigation on the page. We provide a 
refresh link which calls a javascript function to set the url to redirect to 
itself, and have even tried to send to another page which redirects back to the 
main page. The problem is created every time this way.

It appears that the browser is holding the state of the iframe and does not 
release it. It is very problematic and we are not able to allow our users to 
user FireFox with this application and frustrates our FireFox users.
Below is the function I am calling for loading content to my Iframe WYSIWYG 
editor. An ID is passed to the function where elements are located by 
concatenating the ID with a prefix and other naming schemes to get a name of an 
HTML element. Then the elements are either set or retrieved. Some variables are 
declared globally or on the fly.


function GetData(examID)
{	
	Loaded = false;	
	CurrentExamID = examID;			
	
	//Declare variables for Div Tags and get data from them
	var DivReport = "ExamTranscription" + examID;
	var DivResult = "Result" + examID;
	var DivFullName = "FullName" + examID;
	var DivLocationName = "LocationName" + examID;
	var DivOfficePhone = "OfficePhone" + examID;
	var DivOfficeFax = "OfficeFax" + examID;
	var DivPreliminaryRead = "PreliminaryRead" + examID;
	var DivExamTransCount = "ExamTransCount" + examID;
	var DivExamTransNote = "ExamTransNote" + examID;
	var DivExamDesc = "ExamDesc" + examID;
	
	//alert(PrevExamID);
	if (PrevExamID > 0)
	{
		var MyPrevRowName = 'varExamRow' + PrevExamID;
		MyPrevRow = document.getElementById(MyPrevRowName).innerHTML;
		//document.getElementById(MyPrevRow).bgColor='#c0c0c0';	
		document.getElementById(MyPrevRow).bgColor='#ffffff';	
		//document.getElementById('TentSigned' + examID).innerHTML 
= 'true';
		var ctlCheckField = document.getElementById('chk' + 
PrevExamID).innerHTML;
		document.getElementById(ctlCheckField).enabled=false;	
	}
	
	var MyRowName = 'varExamRow' + examID;
	MyRow = document.getElementById(MyRowName).innerHTML;
	document.getElementById(MyRow).bgColor='#ffcc99';	
	//document.getElementById('TentSigned' + examID).innerHTML = 'true';
	var ctlCheckField = document.getElementById('chk' + examID).innerHTML;
	document.getElementById(ctlCheckField).enabled=true;	
	
	try
	{
	document.getElementById(MyRow).scrollIntoView(false);
	}
	catch(ex)
	{
	}
	
	//alert(document.getElementById(MyRow).bgColor);
	//document.getElementById(MyRow).bgColor='#ffcc99';
	//alert(document.getElementById(MyRow).bgColor);
	
	
	//if (ReportEdited == true)
	//{
	//	if (confirm("The " + document.getElementById
(DivExamDesc).innerHTML + " has been edited. Would you like to save?"))
	//	{
	//		//Submit and Save Current Report
	//	}
	//}
		
	PrevExamID = examID;
		
	ReportEdited = false;
						
	document.getElementById(ctlTranscriptionNotes).innerHTML = 
document.getElementById(DivExamTransNote).innerHTML;
	
	var editor = document.getElementById(ctlFreeTextBoxEdit);
	document.getElementById(ctlFreeTextBoxEdit).contentWindow.focus();
	
	
	document.getElementById
(ctlFreeTextBoxEdit).contentWindow.document.execCommand('selectall', false, 
null);
	document.getElementById
(ctlFreeTextBoxEdit).contentWindow.document.execCommand('delete', false, null);
								
	document.getElementById(ctlFreeTextBoxEdit).contentWindow.focus();
	
	
	
	if (window.getSelection)
	{
		var sel = document.getElementById
(ctlFreeTextBoxEdit).contentWindow.getSelection();
	}
	else if (document.selection)
	{
		var sel = document.getElementById
(ctlFreeTextBoxEdit).contentWindow.document.selection.createRange();
	}


	if (sel.type == 'Control')
	{
		return;
	}
	else
	{
		if (sel.pasteHTML)
		{
			var ctlCheckField = document.getElementById('chk' + 
examID).innerHTML;
			if (document.getElementById(ctlCheckField).checked == 
true)
			{
				var ctlTextBox = document.getElementById('txt' 
+ examID).innerHTML;
				ctlTextBox = ctlTextBox.replace(":","_");	
		
				sel.pasteHTML(document.getElementById
(ctlTextBox).value);
			}
			else
			{
				sel.pasteHTML(document.getElementById
(DivReport).innerHTML);
			}
			try
			{
				var SearchRange = null;
				SearchRange = document.getElementById
(ctlFreeTextBoxEdit).contentWindow.document.body.createTextRange()
				SearchRange.findText(" ")
			}
			catch(ex)
			{
			//ignore
			}
			try
			{
			SearchRange.select()
			SearchRange.moveStart("", 0);
			SearchRange.collapse()
			//SearchRange.select();
			}
			catch(e)
			{
			}
			document.getElementById
(ctlFreeTextBoxEdit).contentWindow.focus();
		}
		else
		{
			var oSelection = document.getElementById
(ctlFreeTextBoxEdit).contentWindow.getSelection();
			var oRange = oSelection.getRangeAt(0);
			var ctlCheckField = document.getElementById('chk' + 
examID).innerHTML;
			if (document.getElementById(ctlCheckField).checked == 
true)
			{
				var ctlTextBox = document.getElementById('txt' 
+ examID).innerHTML;
				ctlTextBox = ctlTextBox.replace(":","_");	
		
				var oFragment = oRange.createContextualFragment
(document.getElementById(ctlTextBox).value);
			}
			else
			{
				var oFragment = oRange.createContextualFragment
(document.getElementById(DivReport).innerHTML);
			}
			var oLastNode = oFragment.lastChild;
			oRange.insertNode(oFragment);
			oRange.setEndAfter(oLastNode);
			oRange.setStartAfter(oLastNode);
			oSelection.removeAllRanges();
			oSelection = document.getElementById
(ctlFreeTextBoxEdit).contentWindow.getSelection();
			oSelection.addRange(oRange);
			document.getElementById
(ctlFreeTextBoxEdit).contentWindow.focus();
		}								
	}
	
	
	if (document.getElementById
(ctlFreeTextBoxEdit).contentWindow.attachEvent)
	{
		if (document.getElementById
(ctlFreeTextBoxEdit).contentWindow.document.onkeypress)
		{
		}
		else
		{
			document.getElementById
(ctlFreeTextBoxEdit).contentWindow.document.attachEvent("onkeypress", 
window.parent.DoKeyPress);
		}
	}
	else
	{
		if (document.getElementById
(ctlFreeTextBoxEdit).contentWindow.document.keypress)
		{
			document.getElementById
(ctlFreeTextBoxEdit).contentWindow.document.addEventListener("keypress", 
window.parent.DoKeyPress, false);
		}
		else
		{
			document.getElementById
(ctlFreeTextBoxEdit).contentWindow.document.addEventListener("keypress", 
window.parent.DoKeyPress, false);
		}
	}
	
	
	
	
	document.getElementById(ctlRefDocInfo).innerHTML = 'Name: <b>' + 
document.getElementById(DivFullName).innerHTML + '</b><br>Location: <b>' + 
document.getElementById(DivLocationName).innerHTML +
	'</b><br>Phone: <b>' + document.getElementById
(DivOfficePhone).innerHTML + '</b><br>Fax: <b>' + document.getElementById
(DivOfficeFax).innerHTML + '</b>';
	
	//Display Clear Notes/Hide Sign Report Link
	if (document.getElementById(DivExamTransNote).innerHTML.length == 0)
	{
		//has no notes
		document.getElementById(ctlClearNotes).style.visibility 
= 'hidden';
		document.getElementById(ctlSignReport).style.visibility 
= 'visible';
		document.getElementById(ctlSignReport).innerHTML = '<a 
href=javascript:SignCheck(' + examID + ') accesskey=S onFocus=SignCheck(' + 
examID + ')>Sign Report</a>';
	}
	else
	{
		//has notes
		document.getElementById(ctlClearNotes).style.visibility 
= 'visible';
		document.getElementById(ctlClearNotes).innerHTML = '<a 
href=javascript:ClearNotes(' + examID + ') accesskey=Q onFocus=ClearNotes(' + 
examID + ')>Clear Notes</a>';
		document.getElementById(ctlSignReport).style.visibility 
= 'hidden';
	}
	
	if (SignatureCount < 1)
	{
		document.getElementById(ctlSubmit).style.visibility = 'hidden';
		document.getElementById(ctlSubmit).enabled = false;
	}
	else
	{
		document.getElementById(ctlSubmit).style.visibility = 'visible';
		document.getElementById(ctlSubmit).enabled = true;
	}
	
	//switch (document.getElementById('Result' + examID).innerHTML)
	//{
	//	case 'N':{document.getElementById(ctlResultFindings).value='1';}
	//	case 'P':{document.getElementById(ctlResultFindings).value='2';}
	//	default:{document.getElementById(ctlResultFindings).value='3';}
	//}
	
	if (document.getElementById('ExamTransCount' + examID).innerHTML == '0')
	{
		document.getElementById(ctlReportDisplay).innerHTML 
= '<b>Original Report</b>';
		document.getElementById(ctlOriginalReport).style.visibility 
= 'hidden';
	}
	else
	{
		document.getElementById(ctlOriginalReport).style.visibility 
= 'visible';
		document.getElementById(ctlReportDisplay).innerHTML = 'Addendum 
#' + document.getElementById('ExamTransCount' + examID).innerHTML;
		document.getElementById(ctlOriginalReport).innerHTML = '<a 
href=javascript:ViewOriginal(' + examID + ')>Click To View Original 
Report</a>' ;
	}
	
	Loaded = true;
	
}	

I have a problem with mozille-firefox (Mozilla/5.0 (X11; U; Linux i686; en-US;
rv:1.7.8) Gecko/20050610 Firefox/1.0.4 (Debian package 1.0.4-3)) that might be
related to this bug. I have an example with the following html-pages:

---------------index.html-BEGIN------------------------
<html>
<body>
<iframe src="iframe1.html"></iframe><br />
<iframe src="iframe2.html"></iframe><br />
<a href="javascript:location.reload()">reload</a>
</body>
</html>
---------------index.html-END--------------------------

---------------iframe1.html-BEGIN------------------------
<html>
<body>
Number One
</body>
</html>
---------------iframe1.html-END------------------------

---------------iframe2.html-BEGIN------------------------
<html>
<body>
Number Two
</body>
</html>
---------------iframe2.html-END------------------------

Steps to reproduce:
* Use an text-editor to cut out the first iframe in the index.html.
* Open index.html in mozilla-firefox.
* Undo the change in the text-editor so that the first iframe is present again.
* Press the reload-link in the index.html page

Result:
Both iframes do show "Number Two".

Expected Result:
Iframe one should show "Number One". IFrame two should show "Number Two".
works for me in 20050808 deerpark build on winxpsp2. Please see if you can
reproduce with a recent nightly build and reopen if you can.
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.