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

I have done more work on this and am now satisfied that there is indeed an openacs issue here. I think there were two problems. I have now eliminated the obvious one of the two.

I have triggered my script using:

Y.on("domready", myScript);

...so the timing issue has I think been eliminated, and certainly IE, Firefox and Safari all now render the page correctly on the first request and continue to work regardless of the number of times I refresh.

HOWEVER,

...taking Firefox as a good example:

http://192.168.0.100:8000/xowiki/home

[Page renders correctly, my script runs]

https://192.168.0.100:8440/register/?return_url=http%3a%2f%2f192.168.0.100%3a8000%2fxowiki%2fhome

[Log in proceeds but script does not run on re-direct. No Javascript errors shown and script tags on page appear identical.]

**REFRESH**

[No change]

**REFRESH**

[No Change]

**REFRESH**

[No change]

**REFRESH**

[No Change]

http://192.168.0.100:8000/register/logout

http://192.168.0.100:8000/xowiki/home

[My script fails to run!?]

**REFRESH**

[Page renders correctly, my script runs]

____________________________________________________________

With IE8 the picture is slightly different:

http://192.168.0.100:8000/xowiki/home

[Page renders correctly, my script runs]

https://192.168.0.100:8440/register/?return_url=http%3a%2f%2f192.168.0.100%3a8000%2fxowiki%2fhome

[Log in proceeds but script does not run on re-direct. No Javascript errors shown and script tags on page appear identical.]

**REFRESH**

[Page renders correctly, my script runs]

http://192.168.0.100:8000/register/logout

http://192.168.0.100:8000/xowiki/home

[My script fails to run again!?]

**REFRESH**

[Page renders correctly, my script runs]

There is something that these browsers don't like about this. Could it be the temporary redirect to https for the login and then the switch back? I have considered the Javascript 'same origin' policy as the problem but if the browser is caching the script for the redirected page, it surely must think the origin is the same?

Could it be that we need to fully qualify the url for the script in the header script tag? I tried to exploit the fact that urls containing a question mark are not cached but when I rename my javascript file to end with a ?, xowiki substitutes a character code.

I don't really want to have to direct that the whole page is not cached because there are images that I would like cached. Does anyone have any insights?

Regards
Richard

can you run the whole setup with either only http or only https?
I switched off the https redirect but that resulted in the same behaviour. With Dave's comments in mind, I then studied the event triggers again and discovered that there was indeed still a timing issue resulting in a completely silent failure of the script. It was running, it was just finding nothing!

Beginner's incompetence I guess. At least now I realise just how evil this Javascript monster can be! 😊

Thank you very much for your comments and help.

Regards
Richard