Changing iframe content in IE

I have the requirement of changing the content of an iframe when a link is clicked. To make things a bit more complicated, the iframe is opened as a popup. So, I created an iframe and tried changing the src attribute (and also the location.href). It worked fine
in Firefox, but not in IE. So, after trying it out in a forum and doing a lot of searching on the web, finally came up with a solution. Instead of directly changing the iframe’s attribute, I created div element as the popup and changed the innerHTML of the div element with a new iframe markup that contains the right url. This worked in both Firefox and IE.

1 Comment

Filed under DHTML

One response to “Changing iframe content in IE

  1. Pingback: Using document vs element.ownerDocument « poeticcode

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s