daryl croke
research diary
edim 2002
week 2.
Using the window property to force page reloading.
In the previous week it was proposed to refresh a page by altering and then detecting the height property of the window object.
In changing page.
window.resizeTo(outerWidth, outerHeight);
window.resizeTo(600, 400);
In viewing page.
if(winHeight==600)
do something;
This code worked well in Netscape but failed in Internet Explorer.
Another window property was tested, the "name" property. The
advantage of the "name" property is that it returns a string value.
Therefore a window can be given a name in one HTML page and then tested
in a new page. In effect it works like an external global variable. This
method was tested successfully in Internet Explorer and Netscape.
The changing page performs three functions
- Updates the data base <cf insert>
- Names the window <window.name="refreshPage">
- Returns to the viewing page <body onload="history.back()">
The viewing page
- Test the name of the window
- Renames the window
- Reloads the page.
When the page reloads the variable is retrieved from the database and the correct style sheet is loaded. Because the window name has been changed the page does not meet the test condition and does not reload again.
Changing page.
<cfquery name="update" datasource="dcroke_db">
UPDATE table1 SET
ID='1',
name='medium'
WHERE street='visual'
</cfquery>
window.name="refreshpage";
</script></head>
Viewing page
function pageNew(){
var myWin=window.name;
if(myWin=='refreshpage')
{
//rename page
window.name="bret";
var myWin=window.name;
location.reload();
}
}
</script></head>
This method functioned well see example
http://edim.tafe.vu.edu.au/cfprojects/darylcroke/cf-assignment/home/test1.cfm