Wednesday, September 4, 2013

Load A Javascript File Only If It Hasn't Been Loaded

Here's a neat little Javascript trick if you're worried about a JS resource being loaded more than once. In this example it checks if google maps have already been loaded.


You can also use this trick with !window.jQuery instead of !window.google.

No comments:

Post a Comment