Bruce Frank
2006-06-06 00:35:39 UTC
My web page uses client-side scripting to generate and display HTML. A
skeleton representation of the file looks like this:
<html>
<head>
<script type="text/javascript">
// code to parse QueryString
// code to load XML and XSLT files and set XML parameters based on
QueryString values
// code to perform XSL transform and store output in string variable
document.write(str_output);
</script>
</head>
</html>
The code works great and the web page is displayed as expected. However,
the IE Back button causes the current page to be reloaded instead of
displaying the page associated with the previous URL. This is happening
seemingly because IE is interpreting the call to document.write as
equivalent to requesting a new page and is creating an additional entry in
the history list:
previous web page #1
previous web page #2
page containing call to document.write
HTML passed to call to document.write
When the Back button is clicked, IE goes to the previous entry in the list
and reloads the current URL which in turn regenerates the HTML and displays
the existing page. A check of web server logs confirms that clicking the
Back button causes the same page and supporting files to be retrieved as
were retrieved by the initial request.
Curiously, the history list displayed by clicking on the History button on
the IE toolbar shows only one entry for each explicitly requested page. It
may be that the IE history list internally stores two entries but displays
them as one because there is only one URL associated with the page. This is
only speculation and I don't know what is actually stored in the history
list or what IE is actually doing when the Back button is clicked.
Does anyone know of a way to get the Back button to display the previous web
page in this scenario? Any ideas or suggestions would be appreciated.
Thanks.
-Bruce
skeleton representation of the file looks like this:
<html>
<head>
<script type="text/javascript">
// code to parse QueryString
// code to load XML and XSLT files and set XML parameters based on
QueryString values
// code to perform XSL transform and store output in string variable
document.write(str_output);
</script>
</head>
</html>
The code works great and the web page is displayed as expected. However,
the IE Back button causes the current page to be reloaded instead of
displaying the page associated with the previous URL. This is happening
seemingly because IE is interpreting the call to document.write as
equivalent to requesting a new page and is creating an additional entry in
the history list:
previous web page #1
previous web page #2
page containing call to document.write
HTML passed to call to document.write
When the Back button is clicked, IE goes to the previous entry in the list
and reloads the current URL which in turn regenerates the HTML and displays
the existing page. A check of web server logs confirms that clicking the
Back button causes the same page and supporting files to be retrieved as
were retrieved by the initial request.
Curiously, the history list displayed by clicking on the History button on
the IE toolbar shows only one entry for each explicitly requested page. It
may be that the IE history list internally stores two entries but displays
them as one because there is only one URL associated with the page. This is
only speculation and I don't know what is actually stored in the history
list or what IE is actually doing when the Back button is clicked.
Does anyone know of a way to get the Back button to display the previous web
page in this scenario? Any ideas or suggestions would be appreciated.
Thanks.
-Bruce