Forum OpenACS Q&A: Re: Strange browser behaviour with xowiki page containing javascript

Gustaf, Torben, Dave,

Thank you for the replies. I am sorry I haven't replied sooner but have been away for a few days (actually I went to NYC to be married!). 😊

Had a lovely time.

A couple of days after posting this I discovered that I could reproduce the fault by repeatedly refreshing the browser without logging in. This ruled out the redirect as the source of the problem. I also established that the behaviour was similar but not identical in different browsers.

I came to the conclusion that the issue was a timing issue whereby my script, once in the cache, was running before the document was finished loading. This provisional conclusion was strongly reinforced by your comments.

I imagine that differences in caching behaviour between the browsers is the reason for the slight differences in effect, and the automatic setting for the cache in Explorer probably accounts for the corrective effect of refreshing the page.

I initially thought that the YUI core loader would call my function once the page was loaded, but of course it calls the function as soon as all the required YUI components are loaded, which on a second page request would be very soon indeed and almost certainly before the DOM is fully populated.

I will add the appropriate onload trigger to the page and I expect that to solve the problem.

Thus it appears to be a completely non-openacs question after all, for which I apologise!

R.