Solved

Is there a way to determine whether an external javascript file has already been loaded/included?

Posted on 2013-02-05
1
300 Views
Last Modified: 2013-02-05
Hi:

I'm still in the figuring out stages of webpages, html and javascript.

I've got a base page (which includes external javascript files).
During the course of running the webpage, I'm inserting external
HTML pages into divs. Those external pages themselves include references
to external javascript files.

Is there a way to determine whether an external javascript file has been already
loaded before I attempt to load it?

Thanks,
JohnB
0
Comment
Question by:jxbma
1 Comment
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
Comment Utility
if( typeof [i]name_of_a_function_or_variable_inside_this_external_javascript_file[/i] == "undefined") {

// load it

};

Open in new window

0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now