Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
Thread: Iframe and JS objects
07-21-2010, 04:12 PM #1
- Join Date
- Jul 2010
- Thanked 0 Times in 0 Posts
Iframe and JS objects
I have a very strange issue using dynamic scripting and iframe. It looks like when when iframe is loaded (i.e. onload method is triggered) all js objects that were sent to iframe before disappear? To clarify... I set iframe.scr from java script that caused it to connect to the server. After connection is established I start sending JS code to it (including some JS objects). At some point connection to iframe is closed (and onload method is called). Later on I reconnect (i.e. set src property again), and try to issue method calls on the JS objects that were sent in earlier session. None of these methods get triggered. Did anyone experienced similar problems? Is there a workaround? (I.e. is there any way I can send register JS Objects globally when sent through iframe?).
Thanks for all your help,
07-21-2010, 08:50 PM #2
Changing the .src of an <iframe> is *NO DIFFERENT* than loading a brand new HTML page into the main window.
It *COMPLETELY* wipes out *EVERYTHING* in the window/iframe and replaces it with the new HTML source.
In other words, it is no different than doingand expecting the JS objects on the page to remain in memory. They won't. Period.Code:location.href = "someNewPage.html";
This is, essentially, what AJAX was created for: To allow changes to a page's contents without affecting what already exists except as dictated by the JS code.
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
07-22-2010, 04:01 AM #3
- Join Date
- Jun 2007
- Thanked 600 Times in 580 Posts