/    Sign up×
Community /Pin to ProfileBookmark

Don’t load javascript file twice

Hi all,

I wondered how a module or article can detect if a javascript module is already loaded?

Does the browser check the cache (the same as for images) and so it doesn’t matter?

Mat

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@mrhooAug 31.2011 — It could matter, if the script initiates or assigns vakues to objects when it is evaluated, overwriting any changes made since it was first loaded. You can check for the existence of something defined by the script, if this is an issue.
×

Success!

Help @Wootah spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...