daryl croke
research diary
edim 20027
week 1.
Refreshing pages and developing template code
In the research project so far I have been able to use coldfussion and javascript to load different CSS styles determined by the user (see example).
On clicking onto the link the browser loads a new page which in turn changes a value in a coldfussion database. When the user returns to the original page a new style sheet is loaded. However the browser returns to the page already in the cache, the changes are not visible. Only when the uses refreshes the page (apple + r) or a new page is loaded are the changes visible.
A number of approaches where tried to forcibly refresh the page when loaded.
One approach is to use the content refresh meta tag.
<META HTTP-EQUIV=Refresh CONTENT="5">
Problem, this tag will reload the contents of a page every 5 seconds in effect setting up a perpetual loop.
Another approach is to use the onload function to reload a page.
<body onload="reload()">
this approach also has the effect of creating a continuous loop.
One approach would to use the following Meta tag.
<META HTTP-EQUIV="expires" CONTENT="Tue, 20 Aug 1996 14:25:27 GMT">
"This indicates that the document containing this META tag will expire at this date. If the document is requested after this date, the browser should load a new copy from the server, instead of using the copy in its cache." Source http://www.htmlhelp.com/reference/wilbur/head/meta.html
Theoretically this approach should work however it proved unsuccessful.
Another promising lead was to use the "history object" in javascript to return a string of the previous URL.
Eg. history.previous
A problem however is that for this function to work it requires the UniversalBrowserRead
privilege. Source http://developer.netscape.com/docs/manuals/communicator/jsref/wina2.htm#1014114
To get the history.previous function to work seems to require a lot trouble
and touches on serval security issues see.
http://developer.netscape.com/docs/manuals/communicator/jsguide4/index.htm?content=sec.htm
Yet another method worth considering is to use the onblur() function with form button. When clicked the user would go to the change page. On returning to the viewing page nothing would change however when the user moved to a new link the page would then refresh.
<input type="submit" name="bold" value="bold" onClick="MM_goToURL('parent','change/bold.cfm');return document.MM_returnValue"; onBlur="reload()">
This method seems rather clumsy and the user could continually click onto the link and not see any change. I also want to avoid using form elements for accessibility reasons.
I believe the most elegant method is to use a javascript function that would only refresh the viewing page once the user has changed the value in the coldfusion database. The complication as seen above is to avoid setting up a continual page reloading loop. Below is a guide of one possible method.
- User clicks onto "Change the look of page" - browser goes to changing page.
- Page is resized to available height 50 pixels eg. 768-50 = 718.
- Browser returns to viewing page.
- Javascript function asks, if height less than available height?
- It is and the page resizes to maximum height and reloads.
- Page reloads, javascripts function asks, if height less than available height?
- It isnt so page continues to load normally.