updated 27 sept 2002 | brown | green | blue | grey

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.

var winHeight=window.outerWidth;
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

The viewing 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.

1. Updates database.
<CFINSERT datasource="dcroke_db" tablename ="table1">
<cfquery name="update" datasource="dcroke_db">
UPDATE table1 SET
ID='1',
name='medium'
WHERE street='visual'
</cfquery>

2. renames window.
<script language="javascript1.2">
window.name="refreshpage";
</script></head>

3. Goes back one step.
<body onLoad="history.back()" >

Viewing page

Tests window name
<script language="javascript1.2">
function pageNew(){
var myWin=window.name;
if(myWin=='refreshpage')
{
//rename page
window.name="bret";
var myWin=window.name;
location.reload();
}
}
</script></head>

Call testing function
<body onLoad="pageNew()">

This method functioned well see example
http://edim.tafe.vu.edu.au/cfprojects/darylcroke/cf-assignment/home/test1.cfm

Continue to week 3.