Friday, 15 April 2011

Competing javascript onloads in a main window and iframe -



Competing javascript onloads in a main window and iframe -

i've been reading on activating javascript when onload fired , how link multiple instances (and of pitfalls), there "clash" between onloads if run 1 in body of main parent window , 1 in body of iframe within parent?

an iframe exclusively separate window , document object , separate javascript context. so, javascript in iframe runs independently javascript in host window.

the 2 have nil 1 unless code them seek interact fetching other one's document or window , trying interact objects or variables. if iframe different domain (technically different origin) host page, browser prevent interaction between 2 (security vulnerabilities). different domains, 2 can send messages each other (no direct interaction).

so, unless you're trying create 2 interact purposeful coding aim, 2 onload handlers have nil 1 another.

javascript iframe onload

No comments:

Post a Comment