summaryrefslogtreecommitdiff
path: root/httemplate/elements/onload.js
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2013-08-29 12:01:01 -0700
committerMark Wells <mark@freeside.biz>2013-08-29 12:01:08 -0700
commitf829595fdd9e62b91251fc1cc2726367e558e1d4 (patch)
tree7c38df8ae78d7099108d2dbc48643b215b177c81 /httemplate/elements/onload.js
parent31f3ba70c953bdd40119aa4d4c097ab6d05b5e6c (diff)
better cross-browser onload handlers, fixes #24783
Diffstat (limited to 'httemplate/elements/onload.js')
-rw-r--r--httemplate/elements/onload.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/httemplate/elements/onload.js b/httemplate/elements/onload.js
index bfa7eef..c7bbbb2 100644
--- a/httemplate/elements/onload.js
+++ b/httemplate/elements/onload.js
@@ -12,11 +12,12 @@ Usage:
</%doc>
(function() {
- var tmp = window.onload;
- window.onload = function() {
- if (typeof(tmp)== 'function') {
- tmp();
- }
+ var myonload = function() {
<% $m->content %>
- };
+ }
+ if ( window.addEventListener ) {
+ window.addEventListener('load', myonload);
+ } else if ( window.attachEvent ) {
+ window.attachEvent('onload', myonload);
+ }
})();