473,701 Members | 2,466 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Whta's the Story with document.create Element('iframe ') in IE?

It is recommended by some sources I found to create IFrames in IE
using
document.create Element('<ifram e src="#">')
instead of document.create Element('iframe ').
Why and what browser versions to use it? IE5 or IE6?
Thanks
Sep 9 '08 #1
23 6604
On Sep 9, 3:37 pm, vunet wrote:
It is recommended by some sources I found to create
IFrames in IE using
document.create Element('<ifram e src="#">')
instead of document.create Element('iframe ').
Why
The generally quality of browser issue analysis is extremely poor and
may things get suggested as workarounds for issues that have never
been pinned down or understood by the people making those suggestions.
and what browser versions to use it? IE5 or IE6?
There is no reason to use it at all, at the very least (and certainly)
from IE 6.
Sep 9 '08 #2
>
There is no reason to use it at all, at the very least (and certainly)
from IE 6.
It's not what I've seen around. In fact there was a case where I was
submitting form to remote IFRAME. That never worked for IE6 until I
used the syntax above to fix it, because the was no possible
communication with that IFRAME using IE6.
But are you saying that this workaround could be without the fix I
explain? Also, here is another link where iframe is created like so:
document.create Element('<ifram e src="#">')

http://developer.apple.com/internet/...nt/iframe.html

Thanks
Sep 9 '08 #3
vunet wrote:
[Henry wrote:]
>There is no reason to use it at all, at the very least (and certainly)
from IE 6.

It's not what I've seen around. In fact there was a case where I was
submitting form to remote IFRAME. That never worked for IE6 until I
used the syntax above to fix it, because the was no possible
communication with that IFRAME using IE6.
But are you saying that this workaround could be without the fix I
explain?
User agents based on MSHTML 5.0 and later support this method of W3C DOM
Level 1+ as it was specified. There is no workaround necessary at all.
Also, here is another link where iframe is created like so:
document.create Element('<ifram e src="#">')

http://developer.apple.com/internet/...nt/iframe.html
So we should eat sh*t because a million flies -- and especially the big,
noisy ones -- cannot be wrong?

Please trim, but do not remove, GG's default attribution line.
PointedEars
--
var bugRiddenCrashP ronePieceOfJunk = (
navigator.userA gent.indexOf('M SIE 5') != -1
&& navigator.userA gent.indexOf('M ac') != -1
) // Plone, register_functi on.js:16
Sep 9 '08 #4
On Sep 9, 11:26*am, Thomas 'PointedEars' Lahn <PointedE...@we b.de>
wrote:
vunet wrote:
[Henry wrote:]
There is no reason to use it at all, at the very least (and certainly)
from IE 6.
It's not what I've seen around. In fact there was a case where I was
submitting form to remote IFRAME. That never worked for IE6 until I
used the syntax above to fix it, because the was no possible
communication with that IFRAME using IE6.
But are you saying that this workaround could be without the fix I
explain?

User agents based on MSHTML 5.0 and later support this method of W3C DOM
Level 1+ as it was specified. *There is no workaround necessary at all.
Also, here is another link where iframe is created like so:
document.create Element('<ifram e src="#">')
http://developer.apple.com/internet/...nt/iframe.html

So we should eat sh*t because a million flies -- and especially the big,
noisy ones -- cannot be wrong?

Please trim, but do not remove, GG's default attribution line.

PointedEars
--
var bugRiddenCrashP ronePieceOfJunk = (
* * navigator.userA gent.indexOf('M SIE 5') != -1
* * && navigator.userA gent.indexOf('M ac') != -1
) *// Plone, register_functi on.js:16
OK, so I understand you do not agree with that workaround but if it
was used and it did fix the problem, then what is your better and
correct (!) suggestion to handle those situations?
Sep 9 '08 #5
On Sep 9, 4:39 pm, vunet wrote:
On Sep 9, 11:26 am, Thomas 'PointedEars' Lahn wrote:
<snip>
>>Also, here is another link where iframe is created
like so: document.create Element('<ifram e src="#">')
>http://developer.apple.com/internet/...nt/iframe.html
>So we should eat sh*t because a million flies -- and
especially the big, noisy ones -- cannot be wrong?
<snip>
OK, so I understand you do not agree with that workaround
but if it was used and it did fix the problem,
Which problem?
then what is your better and correct (!) suggestion
to handle those situations?
There is no reason for not using the DOM standard element creation
method for IFRAMEs in any (reasonably) DOM standard browser (and IE
6+).

But if you are challenging people to produce better solutions to
problems you need to state what the problem is that is supposed to be
addressed by the solution, else you are just waiting everyone's time.
Sep 9 '08 #6
On Sep 9, 4:14 pm, vunet wrote:
>There is no reason to use it at all, at the very least
(and certainly) from IE 6.

It's not what I've seen around.
So what? If you look you will be able to find someone on the Internet
telling you anything and everything.
In fact there was a case where I was submitting form to
remote IFRAME. That never worked for IE6 until I used
the syntax above to fix it, because the was no possible
communication with that IFRAME using IE6.
What does "no possible communication" mean? You see what I man about
the quality of analysis? Communicating, in the sense of reading object
properties, executing contained scripts and so on, is entirely
possible in IE 6, I do it all the time.
But are you saying that this workaround could be without
the fix I explain?
You did not explain anything, and you have not stated what it is that
is supposed to be worked around.
Also, here is another link where iframe is created like so:
document.create Element('<ifram e src="#">')

http://developer.apple.com/internet/...nt/iframe.html
<quote cite="http://developer.apple .com/internet/webcontent/
iframe.html">
Sadly, referencing the IFRAME's document object is no simple
task, since IE5, IE5.5, IE6, and NS6 all provide different
ways to access it. ...
</quote>

IE 5, 6 and 7, all Netscape 6+/Mozilla/Firefox/Gecko, Opera, Safari,
and quite a list of other browsers all provide a single consistent and
reliable method of accessing the documents contained in IFRAMEs. If
the author of that page is not aware of that fact then it is not
surprising that he/she has wondered off into a world of stupid
workarounds and UA branching code to try and mitigate for their
evident ignorance. It happens all the time, but that does not make
following a good idea.
Sep 9 '08 #7
On Sep 9, 12:03*pm, Henry <rcornf...@rain drop.co.ukwrote :
On Sep 9, 4:14 pm, vunet wrote:
There is no reason to use it at all, at the very least
(and certainly) from IE 6.
It's not what I've seen around.

So what? If you look you will be able to find someone on the Internet
telling you anything and everything.
In fact there was a case where I was submitting form to
remote IFRAME. That never worked for IE6 until I used
the syntax above to fix it, because the was no possible
communication with that IFRAME using IE6.

What does "no possible communication" mean? You see what I man about
the quality of analysis? Communicating, in the sense of reading object
properties, executing contained scripts and so on, is entirely
possible in IE 6, I do it all the time.
But are you saying that this workaround could be without
the fix I explain?

You did not explain anything, and you have not stated what it is that
is supposed to be worked around.
Also, here is another link where iframe is created like so:
document.create Element('<ifram e src="#">')
http://developer.apple.com/internet/...nt/iframe.html

<quote cite="http://developer.apple .com/internet/webcontent/
iframe.html">
Sadly, referencing the IFRAME's document object is no simple
task, since IE5, IE5.5, IE6, and NS6 all provide different
ways to access it. ...
</quote>

IE 5, 6 and 7, all Netscape 6+/Mozilla/Firefox/Gecko, Opera, Safari,
and quite a list of other browsers all provide a single consistent and
reliable method of accessing the documents contained in IFRAMEs. If
the author of that page is not aware of that fact then it is not
surprising that he/she has wondered off into a world of stupid
workarounds and UA branching code to try and mitigate for their
evident ignorance. It happens all the time, but that does not make
following a good idea.
With my original question I was hoping to hear what experts think if
they are familiar with what I am asking.
This went the wrong way, so let me state the problem I personally had.
I created a mechanism to upload images keeping the user on one page.
The form would submit image files into dynamically created IFRAME. I
developed this in Firefox but when I started testing IE6 form was not
able to submit to my hidden IFRAME: it did not see it... This form's
target was IFRAME's name.
When I did some research I discovered that if I create IFRAME like
this for IE6 (document.creat eElement('<ifra me src="#">')) then it
would work for me and it did.
That's why I am wondering why it happened and is it something I should
be better off using for IE6 or less?
Thanks
Sep 9 '08 #8
vunet wrote:
I created a mechanism to upload images keeping the user on one page.
The form would submit image files into dynamically created IFRAME. I
developed this in Firefox but when I started testing IE6 form was not
able to submit to my hidden IFRAME: it did not see it... This form's
target was IFRAME's name.
When I did some research I discovered that if I create IFRAME like
this for IE6 (document.creat eElement('<ifra me src="#">')) then it
would work for me and it did.
Talk is cheap. Show me the code.
-- Linus Torvalds
That's why I am wondering why it happened and is it something I should
be better off using for IE6 or less?
You are asking all the wrong questions.
<http://catb.org/~esr/faqs/smart-questions.html>

Again, please trim your quotes.
PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f8************ *******@news.de mon.co.uk>
Sep 9 '08 #9
vunet :
It is recommended by some sources I found to create IFrames in IE
What sources ?
using document.create Element('<ifram e src="#">')
instead of document.create Element('iframe ').
Are you sure it is the "src" attribute the problem ? This is not the
issue I am aware of.
<http://msdn.microsoft. com/en-us/library/ms536389.aspx>
<quote>
Attributes can be included with the sTag as long as the entire string
is valid HTML. To include the NAME attribute at run time on objects
created with the createElement method, use the sTag .
</quote>

This code will *not* "work" in IE6 or IE7, but will in IE8b2

<a href="http://www.google.fr" target="myIfram e">link</a>
<script type="text/javascript">
var iframe = document.create Element('iframe ');
iframe.name = 'myIframe';
document.body.a ppendChild(ifra me);
</script>

This code will "work" in IE6 and IE7, but will *not* in IE8b2

<a href="http://www.google.fr" target="myIfram e">link</a>
<script type="text/javascript">
var iframe = document.create Element('<ifram e name="myIframe" >');
iframe.name = 'myIframe';
document.body.a ppendChild(ifra me);
</script>

As you can see (once tested), the issue IE6 can encounter is related to
the name attribute of the newly created element, I have tested with your
src workaround and I can't find any other issue than the "name" one.

So, are you really sure about the src="#" workaround ?

--
laurent
Sep 9 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
47339
by: Templar | last post by:
Hi i'm bothering with such problem... I must dynamic create an Iframe, and then put som raw HTML into it. But I can't. When I create iframe, I can't access its properties. Here's the coe snipplet: //************************************* //*************************************
1
24642
by: Martin | last post by:
There seems to be some strange behaviour when trying to get the scrollHeight and scrollTop of an iframe in IE6. I have tried several ways of getting these values when the iframe is written into the html. The following return the correct values in IE6, where the iframe's id is 'f': f.document.body.scrollHeight f.document.body.scrollTop window.frames.document.body.scrollHeight
7
4862
by: Christopher J. Hahn | last post by:
I'm trying to use a script-generated form to submit to a script-generated iframe. The problem I'm running into is that the iframe is not assuming the name I assign it. IE6 on Win2000. FF1.0.2+ doesn't seem to have the problem. I'm doing: this.iframe = document.createElement( 'iframe' ); this.iframe.id = this.id + 'wh'; this.iframe.style.display = 'none';
16
7108
by: Mcginkel | last post by:
I am trying to find a way to load XHTML content in an Iframe. I use to do this in html by using the following code : var iframeObject = document.createElement("iframe"); MyDiv.appendChild(iframeObject); var data = "<html><head><title>testing</title></head><body>data</body></html>" iframeObject.contentDocument.open(); iframeObject.contentDocument.writeln(data);
1
6668
by: jaktharkhan | last post by:
Hi, I really really need help in trying to figure out how can I do a CloneNode on an Iframe where the cloned IFRAME clones with all its contents?. Basically what I am doing is dynamically building a table with Iframes inside it. The problem is I just want to build one Iframe because the contents of it can be very complex. After my Iframe is built I just want to clone the iframe as many times as I need later. I cannot use an HTML file and...
4
2554
by: Drew | last post by:
This might beyond the scope of this group because it deals with SharePoint, but I'm not sure if I can't get it to work because of SharePoint or because JavaScript is weird (I don't have much experience with JavaScript). Anyway, here is the code i'm working with. Basically, it creates appends a hidden IFrame to the page, gets the links from the IFrame, and displays those which have the "OnLink" property. The weird thing is that when I...
10
3835
by: jon | last post by:
I'm trying to use a hidden iframe to print the contents of one div seamlessly. Currently I can create the hidden iframe, copy the contents of the div to the iframe, and print it. I even have a method that initially copies all the original page's styles onto the new iframe to maintain look and feel. So far things work, and the div (along with look and feel from styles) are successfully copied to the iframe and printing just the hidden...
1
5280
by: XP | last post by:
Hello Everyone, I was stuck with this really frustrating problem for sometime. Let me explain what I am trying to achieve: There is a form and an inner iframe. The form's target is set to the iframe so that when the form is submitted, the page does not get reloaded/changed ( as the iframe would be the one getting refreshed. The Iframe is set to have 0 width and height to make it look invisible ). I have a copied the html source ( at...
2
3280
riptide2049
by: riptide2049 | last post by:
I really have a problem here. I have a code that is suppost to take the href of a link from the right class;value of a link maked toreturn false. the value is a Media file the file is sent to quicktime or windows meida player depending on which plugin was found. after the plug in is found a iframe with the right player is created. here is the code. for some reason In IE the plug in doesnt work and in fire fox it crashes <!DOCTYPE html...
0
8649
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9223
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9083
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6569
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5904
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4662
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3102
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2398
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2035
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.