Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
311 views
in Technique[技术] by (71.8m points)

javascript - Is there a cross-browser standard on-load event for HTML's "object" tag?

I am aware that IE supports the onreadystatechange attribute on the object tag, but this doesn't seem to be a standard way thus all other browsers do not support it.

Update: To clarify, I am not looking for the DOM Load event, I am looking for the load event of the object tag itself(e.g. an object tag embedding a PDF file into a page).

In a way, I am looking for something similar to img's onload event /complete attribute for the object tag.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The <object onload> attribute works well in latest versions of Firefox, Chrome and Opera (I've just tested it).

Also, the expression 'onload' in document.createElement('object') evaluates to true in Chrome and Opera; naturally, Firefox is an exception because such event support check doesn't work there generally. kangax describes cross-browser event support detection at http://perfectionkills.com/detecting-event-support-without-browser-sniffing/


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.9k users

...