Solved

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

Posted on 2013-02-05
1
302 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
ID: 38857641
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
how i fix Remove render-blocking JavaScript 3 52
how can i apply an assert arrayEqual function ? 2 24
PHP Form Calculate Total Price 10 40
Outlook opens HTML email as text 4 22
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

786 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