W3C home > Mailing lists > Public > www-html@w3.org > December 2004

"iframe" and dom problem

From: June Lee <antinet@nextware.co.kr>
Date: Thu, 16 Dec 2004 10:49:49 +0000
Message-Id: <200412150945.iBF9jUkS007707@ns.nextware.co.kr>
To: <www-html@w3.org>, <www-dom@w3.org>
I have writing a book on javascript, html, dom.
I have encountered a problem on "iframe".
 
In "XHTML 1.0 Strict DTD", iframe element is deleted.
"iframe" element is in XHTML 1.0 Transitional DTD,
XHTML 1.0 Frameset DTD.
 
Regard to iframe element and iframe dom, I have
question. before question, i'll explain my situation.
 
1) iframe element is deleted in XHTML 1.0 Strict.
 
using
"<object data="embed.html" type="text/html" width="200" 
  height="400"></object>"
insted of 
"<iframe src="embed.html" />"
is well-formed in "XHTML 1.0 strict".
 
2) Using object insted of iframe has DOM problems in browsers.
 
html code : 
<object id="myEmbed" data="embed.html" type="text/html" width="200" 
  height="400"></object>
 
I can use below DOM :
self.document.getElementById("myEmbed").data
: it means data attributes of "myEmbed" element
(DOM Level 2, works in Mozilla and IE6).
 
self.document.getElementById("myEmbed").contentDocument.lastModified
: self.document.getElementById("myEmbed").contentDocument means
  document object of "myEmbed" element. it is document object.
(DOM Level 2, works in Mozilla not in Mozilla).
 
self.document.getElementById("myEmbed").document.lastModified
: self.document.getElementById("myEmbed").document means
  document object of "myEmbed" element. it is document object.
(DOM Level 2, works in IE. not in Mozilla).
 
Conclusion :
If use "object" istead of iframe, I can't access iframe window object. 
And for document object, IE6 and mozilla use different name.
 
So using object insted of iframe has problems width regard to DOM.
 
3) using "iframe", there is no DOM problem.
html code : 
<iframe id="myEmbed" src="embed.html"></iframe>
 
I can use below DOM :
self.document.getElementById("myEmbed").contentWindow.location.href
: self.document.getElementById("myEmbed").contentWindow is
  iframe window object. 
(DOM Level 2, works in IE and Mozilla).
 
self.document.getElementById("myEmbed").contentWindow.document.lastModified
: self.document.getElementById("myEmbed").contentWindow.document is
  document object of iframe window object.
(DOM Level 2, works in IE and Mozilla).
 
4)
I have to choose ...
 
a. using "object" insted of "iframe". but, it has dom limitations.
   (mozilla and ie is differ in document object referencing. and
    can't refer window object).
    
b. using "iframe". but, it isn't "xhtml 1.0 strict".
   So, if use "iframe", use "xhtml 1.0 transitional" instead of 
   "xhtml 1.0 strict".
 
which is best choice?
Received on Thursday, 16 December 2004 19:38:27 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:16:01 GMT