About this blog

Hi folks, Jamie here.

I'm a web developer at the Ionic Business Systems.
I blog about web development, content management systems, design, user experience and anything else that comes to mind.

Feeds

How to remove <object> html markup using javascript in IE6 and IE7

UPDATED please see this post.

Let’s say you have a quicktime movie, and it’s marked up in your HTML using the <object> tags.

In Firefox you can use the removeNode(id of your quicktime object tag) method to remove quicktime object. This works fine.

However in IE 6 and IE 7 this will not work. Surprise, surprise! The quicktime object/player will stay on the screen even though it does no longer exist in the DOM. You’ll need to refresh to get ride of it. Not very nice!

To properly remove a quicktime object using IE6 and Ie7 using javascript you’ll need to do one extra step.

What you’ll need to do is first set the css display property of the quicktime object to none.

Now you can use the normal removeNode(id of your quicktime object tag) to remove it.

So something like this

var e = document.getElementById(’id of your quicktime object’);
e.style.display = ‘none’;
document.body.removeChild(e);

One Response to “How to remove <object> html markup using javascript in IE6 and IE7”

  1. October 16th, 2007 at 4:26 pm

    [...] I recently posted on this topic. [...]

Leave a Reply