"swisst" wrote : So you are having a single portlet download common javascript
files that are used by multiple portlets? That sounds like a bad idea....If this is truly
common js code, why not have the theme load it for you? Or reference it in every portlet,
the browser will be smart enough to cache it for you.
|
| If you are set on your current structure, my guess is that your other portlets that
are trying to execute the javascript should tap into the onload event and start processing
then.
that would mean his portlet would be link to a specific theme. Change the theme, the all
site go down :-)
btw, if you add all js in the theme -and when working with ajax/mootools it can result by
adding >20>50>100 js files ! (ok, on a really big fancy site...)
I understand what dickinson try to do because, well, I'm doing the same. :-)
You cannot relly on the cache neither : every time the browser found a , it runs it, that
a major problem. not only it's time consuming, but it could create some js exception.
A solution is to add script, that load script :-) basically something like :
| <div id="<portlet:namespace/>_scripts"></div>
| <script type="text/javascript">
| if (typeof MooTools == "undefined") {
| var script = document.createElement("script");
| script.src = "${renderRequest.contextPath}/js/mootools.js";
| script.type= "text/javascript";
| var <portlet:namespace/>_scripts =
document.getElementById("<portlet:namespace/>_scripts");
| <portlet:namespace/>_scripts.appendChild(script);
| }
| </script>
|
I almost finished a little script that make the process less painfull.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4132872#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...