You are currently in: Whatever. Skip to site menu.

Found It On the Web...

Commentary on “Frame Branding” (2000.09.07)

So today I get an e-mail from The JavaScript Source (at work I’ve got a subscription to their daily e-mail newsletters (I think my boss signed me up for it), it’s mostly just fancy tricks and nonsense, although sometimes they have some good ideas).

Today’s JavaScript bit is called “Frame Branding” and it’s about how to do that thing that Hotmail and does in which the site you’re linked to shows up underneath a small frame header that says something like “To return to our site, close this window.” I bring this up because it reminds me about frames and the target attribute and strict HTML.

You see, the World Wide Web Consortium has broken HTML into three “Document Type Definitions” (DTDs). There’s Strict DTD which wants to make HTML purely structural (and using Cascading Style Sheets to handle the presentation of how the Web page will look). There’s Transitional DTD which you can consider the default since it is the Strict DTD but with the inclusion of tags and attributes that Netscape and Internet Explorer created (such as FONT). And finally there’s Frameset DTD which is the Transitional DTD but says that a page is creating frames.

Now, that frames have been around for awhile, often times site programmers will wish that their site does not appear within someone else’s frame. There are a few ways of doing this. One is with JavaScript. But if a user does not have JavaScript enabled, there are HTML options. One is to give every link an attribute/value pair of target="_top" (thereby ensuring that each link fills the browser window and breaks the site out of the frame), and another way is to use a BASE tag with an attribute/value pair of target="_top".

So let’s say that a Web site programmer decided to link to your site, but made it appear in the bottom 25% of their framed site (either by the JavaScript method The JavaScript Source gave us, or by other means). And let’s say that the visitor who followed this link does not know how to break your site out of that tiny bit of frame space alloted for your Web site to appear in. This sounds easy to do, even with HTML just in case the visitor has JavaScript turned off. But let’s also say that you want your Web site to conform to the W3C’s Strict DTD.

Ah, now there we have a problem. The attribute target is not part of the Strict DTD because “target” is an attribute which dictates which frame to load the desired link. Even though the value “_top” means the top of the browser document (thereby breaking a page out of a frame) and “_blank” means a new, unnamed browser window. Using the definition of the “target” attribute, I can understand why it is not in the Strict DTD. But by the very nature that Frameset DTD exists (and that people have the ability to open up other Web sites within a small, inaccessible frame window), I think that there should be a mechanisim within the Strict DTD to make sure that (or provide an option that) Strict DTD pages do not appear inside of framed documents.

And that’s my rant for tonight.

“Found It On the Web” Archives:

Go to Archives by Category.