Skip to content
This repository has been archived by the owner on Dec 31, 2022. It is now read-only.

Script.aculo.us's own dynamic loader breaks in Chrome #4

Closed
haarts opened this issue May 18, 2010 · 5 comments
Closed

Script.aculo.us's own dynamic loader breaks in Chrome #4

haarts opened this issue May 18, 2010 · 5 comments
Labels

Comments

@haarts
Copy link

haarts commented May 18, 2010

Using LABjs to load Prototype and Scriptaculous from a CDN results sometimes in a blank page when using Chrome. The page is seen to load properly but after a fraction of a second the screen turns blank. The page is 'still there', that is inspecting the source reveals all the proper HTML. This behaviour is not consistent, sometimes it does work.

I tried setting AlwaysPreserveOrder to true, to no effect.
I tried moving off the CDN but that resulted in the dynamic libs (such as effects/builder/etc) not to be load at all. It would work when explicitly calling/loading these libs. The blanking would disappear. This makes me believe loading via XHR (UseLocalXHR) has some effect, which I do not know.

This behaviour can (sometimes as it's not consistent) be seen on our staging server at http://staging.delaagsterekening.nl.

The offending file is http://ajax.googleapis.com/ajax/libs/scriptaculous/1.8.3/scriptaculous.js

Probably the solution is staring me in the face.

@haarts
Copy link
Author

haarts commented May 19, 2010

Actually this is a Webkit issue. Safari is also affected.

@getify
Copy link
Owner

getify commented May 25, 2010

It's the use of document.write() in that file. document.write() is NOT compatible with dynamic loaders. There's a race condition inherent that if document.write() is executed before onload, then things are probably ok, but if it goes after that (which can happen intermittently) a document.write() will screw up the page. It can crash IE, and the behavior of seeing the page go blank is quite expected when document.write() runs after a page is loaded.

The solution is to load scriptaculous manually, then load any other files that don't have document.write() in them with LABjs.

I really wish the frameworks would get their act together (like jQuery did) and get rid of this junk that makes dynamic loading impossible.

@haarts
Copy link
Author

haarts commented May 25, 2010

Yet another reason to switch to jQuery. :S

Thanks for the explaination. I got around the problem by hacking Scriptaculous and removing the dynamic loading of the modules. I then loaded them myself by pointing LABjs to the correct files.

@aakoch
Copy link

aakoch commented Oct 23, 2010

Isn't the right fix to remove the document.write() statements?

@haarts
Copy link
Author

haarts commented Oct 24, 2010

That is what I ended up doing.

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants