/    Sign up×
Community /Pin to ProfileBookmark

how to check if the picture already output?

Hi everyone,

Let say, i have a page that output this a several image, how to check weather a certain image already successfully load to user browser?

example image:

<div><img src=’http://www.nasa.gov/images/content/84857main_EC04-0325-23_lg.jpg‘ width=’336′ height=’280’></div>

i need to return a value is the picture finish load.

Thanks.

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@FangJul 08.2007 — Remove the height/width attributes from the image.

Check if loaded:if(document.getElementById(imgID).height){//it's loaded}
//or
if(document.getElementById(imgID).complete){//it's loaded, but doesn't work in all browsers}

If the user has images disabled, the you could get a false positive.
×

Success!

Help @kennyTE 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 4.26,
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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

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