iFrames and JavaScript fail?

Was trying to create the typical button to “remove frames” from a site, opening the main iframe content in the full window. While it was easy to make the iframe content to change with a simple HTML link and a target property, it is not easy to make the “remove frames” button to work.

I tried a simple JavaScript function that retrieves the ‘src’ property from the ‘iframe’ object and assigns it to the document location. Unfortunately, it seems that both Firefox and Chrome does not update the iframe DOM object with the correct url property when the user clicks in one link that uses the “target” property.

My current solution would be to change the links with target property to JavaScript actions. But that is insane.

Am I doing something wrong? And, this is a bug or a feature?