W3C home > Mailing lists > Public > public-html@w3.org > February 2008

IFRAME - @name should be allowed

From: Michael A. Puls II <shadow2531@gmail.com>
Date: Wed, 13 Feb 2008 20:03:01 -0500
Message-ID: <6b9c91b20802131703y3394493co3bc104447871ca73@mail.gmail.com>
To: public-html@w3.org

Consider the following text/html example:

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <style>
            #test {
                border: 1px solid #000;
                width: 600px;
                height: 300px;
            }
        </style>
    </head>
    <body>
        <p><a href="http://example.com/" target="test">test</a></p>
        <p><iframe id="test"></iframe></p>
    </body>
</html>

Clicking on the link in Opera and Safari will load example.com in the
iframe. Doing the same in IE7 and Firefox will open example.com in a
new window/tab.

To make things work *as intended* in all browsers, you need
name="test" on the iframe.

Even if you were to consider a script solution with an onclick
handler, @name is still needed for the frames collection in Firefox so
that you can do a frames["test"].location.href change for example. Of
course, you could do getElementById("test") and do a .src change. But,
in other situations where you want to do something with the framed
document, you might want to use the frames collection instead of
getElementById, so you don't have to mess with the
document/contentDocument issue between IE and other browsers. In this
case, the frames collection is desired, but doesn't work without the
@name on the iframe, unless you use frame indexes.

But, even though you can do a suitable JS solution and workaround the
issues, it shouldn't be necessary.

So, @name needs to be allowed on iframe, especially as part of
supporting existing content.

Of course, since the same type of issue happens with @id and @name for
MAP, maybe there needs to be more discussion on how this should be
handled.

-- 
Michael
Received on Thursday, 14 February 2008 01:06:35 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 9 May 2012 00:16:12 GMT