I would like the transition from the content on my page to the contents of the iframe to be seamless, assuming the background colors are consistent. The target browser is IE6 only and unfortunately solutions for others will not help.

Kinda depends on your doctype. If you're writing a HTML 4.01 document, then frameBorder='0' is the way to go. But if you're writing a HTML5 document, consider using attribute seamless='seamless' because in HTML5, attribute frameBorder is no longer supported.
–
Martin AnderssonOct 22 '12 at 16:16

8

@MartinAndersson but the question was about a solution for IE6
–
jalfFeb 6 '13 at 9:43

1

Took me a minute to figure out in JavaScript you just need element.frameBorder=0. no .style and use 0, not '0'
–
andersAug 2 '14 at 23:34

When validating the document using Markup Validation ServiceframeBorder results in an error as it's not HTML5 compliant: The frameborder attribute on the iframe element is obsolete. Use CSS instead. In HTML5 I would set a CSS property of border:0. Is there a way to make it backward compatible without causing validation errors?
–
Matthew T. BakerFeb 26 at 11:31

Also you can use seamless attribute which is new in HTML5. The seamless attribute of the iframe tag is only supported in Opera, Chrome and Safari. When present, it specifies that the iframe should look like it is a part of the containing document (no borders or scrollbars). As of now, The seamless attribute of the tag is only supported in Opera, Chrome and Safari. But in near future it will be the standard solution and will be compatible with all browsers. http://www.w3schools.com/tags/att_iframe_seamless.asp

You can also do it with JavaScript this way. It will find any iframe elements and remove their borders in IE and other browsers (though you can just set a style of "border : none;" in non-IE browsers instead of using JavaScript). AND it will work even if used AFTER the iframe is generated and in place in the document (e.g. iframes that are added in plain HTML and not JavaScript)!

This appears to work because IE creates the border, not on the iframe element as you'd expect, but on the CONTENT of the iframe--after the iframe is created in the BOM. ($@&*#@!!! IE!!!)

Note: The IE part will only work (of course) if the parent window and iframe are from the SAME origin (same domain, port, protocol etc.). Otherwise the script will get "access denied" errors in the IE error console. If that happens, your only option is to set it before it is generated, as others have noted, or use the non-standard frameBorder="0" attribute. (or just let IE look fugly--my current favorite option ;) )

Took me MANY hours of working to the point of despair to figure this out...