I have a problem with the optimization of the speed of my application.
I have ajaxLink which opens a dialog box using zii.widgets.jui.CJuiDialog.
Dialog box opens for about 5 seconds - it is much slower than for example on the site jquery.com.
Using firebug, I found that the problem is that jquery libraries loaded twice: when you open the dialgo box jquery and jquery.ui loaded again from the folder assets. They loaded with some numbers, like this:
jquery.js?=1304664973349 and jquery-ui.min.js?=1304664975489
Each library is loaded for about 2 seconds, so opening the window takes about 5 seconds.
There is any way to prevent the reloading of libraries?
I’m not pretty sure, but it looks like a bug. You should issue a ticket in a bug system, but I’m not sure if in Yii or in jQuery.
The moment of opening a dialog box is in my opinion entirely controlled by jQuery, not by PHP (and therefore Yii). Page is already generated at this stage, sent back to browser and browsers is responsible for executing any JavaScript code inside generated page (or referenced by it).
My shot would be that this is jQuery problem. Although I never run into issue of delay before opening a dialog box or jQuery being loaded twice. Can you upload somewhere a working example?
I am also having this same problem, 2 jquery.min.js files are being loaded one from google cdn and other one from assets, searched a lot, but coudn’t managed to find the source, can you please tell me where to put
Since this is just a line of code, then you can put it virtually anywhere, for example, in your controller. But, if I’m not mistaken, you can also configure scriptMap directly in application configuration, just as you would do with other bulid-in application modules. Search the documentation and forum, this topic (or similar ones) where discussed a few times.
Not quite. This is the code that tells Yii to not to load bundled with it copy of jQuery. But you must provide your own by yourself. But, from your answer it seems that you’re already doing it, so – yes, it should stop jQuery from being loaded twice.