PS2 Xbox Nintendo Dreamcast Games - PS2 Xbox Nintendo Dreamcast Games - Anime Episodes - TV News - Sport Betting Systems

PDA

View Full Version : Conditional Javascript loading


Nick_Mayhem
Jul 7th 2008, 11:24 pm
Hello :)

I have a scenario where the Javascript libarary is loaded from an external source.

But if the code is repeated on the page. Then it loads the libraries more then once.

Can someone help me with some javascript code that will only allow the libraries to be loaded once.

It could be something like it can check if it is loaded and if it is loaded then it should not load it again.

But I don't know how to implement that.

Thanks.

Greg Carnegie
Jul 8th 2008, 10:18 am
Well maybe show us what you already have, then it will be easier for us to help you, anyway why not load javascript in the <head> section and never think again about loading it again?

Nick_Mayhem
Jul 8th 2008, 10:37 am
Well maybe show us what you already have, then it will be easier for us to help you, anyway why not load javascript in the <head> section and never think again about loading it again?

No it was not possible to load it in Head tags as the sites where this will be loaded will not be controlled by me.....

But as of now I have found a way to set a flag to true if library is loaded and if the flag is true then don't load the library.