sambroblog. A Blog. With words. And maybe pictures.

1Jun/101

Gotcha: Removing iframe border in IE.

Think I'm gonna start a little mini-series of blog posts with the little "gotchas" I run into during the course of an ordinary day at work. Some of the pitfalls I've run into lately have been ridiculous. Bloody IE!

Todays one is a fun one. Removing a frameborder on an iframe in Internet Explorer is case-sensitive, would you believe it!

That is to say:

<iframe frameborder="0" src="http://www.google.com.au/"></iframe>

.. Probably won't work. Whereas:

<iframe frameBorder="0" src="http://www.google.com.au/"></iframe>

Will!

This also extends to creating an iframe using DOM. You need to do this:
Think I'm gonna start a little mini-series of blog posts with the little "gotchas" I run into during the course of an ordinary day at work. Some of the pitfalls I've run into lately have been ridiculous. Bloody IE!

Todays one is a fun one. Removing a frameborder on an iframe in Internet Explorer is case-sensitive, would you believe it!

That is to say:

myIframeEl.setAttribute("frameborder", "0");

Is not going to work in IE.

myIframeEl.setAttribute("frameBorder", "0");

But this will.

Comments (1) Trackbacks (0)
  1. I’ve ran into that one before. jQuery even abstracts that away. https://github.com/jquery/jquery/blob/master/src/attributes.js#L22


Leave a comment

(required)

No trackbacks yet.