[Geoprisma-dev] Dynamically loading JS

James McGrath jmcgrath at nippour.ca
Mon Mar 29 16:00:54 EDT 2010


Hi list,

 

I just got an idea that I’m just throwing like that that could help reduce
the quantity of JS loaded on startup of geoprisma.  Some widgets are loaded
in stand-by to be used (And probably won’t be used in a typical session), we
could change heavy widgets so it loads only when first called by including
the JS dynamically using this :

 

---------------------------------

var script = document.createElement('script');

script.src = "widget/foobar/dynaJS.js";

script.type = 'text/javascript';

script.defer = true;

var head = document.getElementsByTagName('head').item(0);

head.appendChild(script);

---------------------------------

 

I’m using this sort of dynamic script inclusion for another project and so
far it works with every browser we used.  I think it could help a little for
a js hungry implementation.

 

 

Regards,

 

James McGrath
Programmeur/Analyste 

 <http://www.nippour.ca> www.nippour.ca
Tél.: (418) 548-5556 poste 45 
Téléc.: (418) 548-5445
Sans frais : 1 800 776-0007

Jonquière . 2655, bd. du Royaume, Bur. 600

Le présent message (ainsi que ses éventuelles pièces jointes) peut contenir
des informations confidentielles. Étant établi à l'intention de son
destinataire, son utilisation ou sa diffusion non autorisée est interdite.
Si vous recevez ce message par erreur, merci de m'en aviser immédiatement.

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/geoprisma-dev/attachments/20100329/ba523e07/attachment.html


More information about the Geoprisma-dev mailing list