Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

iframe in xhtml1.1 how-to?

Posted on 2003-11-05
Last Modified: 2007-12-19

Xhtml 1.1 doesn't seem to have the iframe module in its standard dtd. It should be possible to add the iframe module yourself.

However, I'm having a hard time finding easy-to-read documentation or a simple dummy tutorial on how-to expand the xhtml1.1 dtd with the iframe module. I'm not a newbie on html, but I don't quite grasp xhtml modularisation.

Therefore, 2 questions:
1) Do I need to expand the xhtml1.1 dtd with the iframe module to use an iframe in xhtml 1.1 or not?
2) If so, how do I do that? If not, is there another way?

Question by:OmegaJunior
  • 4
  • 3
LVL 17

Accepted Solution

dorward earned 125 total points
ID: 9686923
Why are you using XHTML 1.1 in the first place? Or iframes for that matter?

http://www.w3.org/TR/1999/WD-xhtml11-19990910/xhtml11_modules.html#a_module_Iframe has the iframe module.

http://www.juicystudio.com:80/tutorial/xhtml/module.asp should get you going with using it.

Frankly, if you have a pressing need for XHTML, use 1.0. Browser support is such that 1.1 isn't generally wise (MSIE rejects it entirely as it can't conform to the spec and be sent with a text/html content type). If you have a pressing need for iframes, use 1.0 Transitional. Most people shouldn't have a pressing need for either.

Author Comment

ID: 9687163
Thank you dorward, this looks interesting. I'm going to try it.

Why do I want to use xhtml 1.1? Just because. I'm a geek. ;) I can do this in xhtml1.0 transitional. And as far as I've seen, Internet Explorer 6 has no trouble rendering xhtml 1.1. (My host, otoh, has the nasty habit of preprocessing all html and replaces the <body> with <BODY>, very bad.)

Why do I want to use an iframe? I have about 160 articles, that are going to be marked up in xml. (They're in html right now, published on my own site, living there very happily.) By using a frame, I can load any article into a "static" backdrop that holds the navigational menus. Using css I can attach styling to the articles. So I could use a normal frame, if my backdrop had allowed that. However, I'm working on a specific backdrop that makes the use of a normal frame quite hard, if not impossible. An iframe is much better suited for this particular job.

Instead of an iframe I could of course use javascript to load the article information into a div in the backdrop. But when someone had turned off javascript support in their browser, no information would be seen. Very bad for an information web site. By using an iframe I have a) far better chances for the information to be seen and b) no need to write browser-specific code for handling xml-import.
LVL 17

Expert Comment

ID: 9687245
XHTML 1.0 is allowed to be served as text/html
XHTML 1.1 is not.

When you serve Internet Explorer some application/xhtml+xml it prompts the user to download it.

Try avoiding frames altogether and use CSS for the layout, in layout terms it can recreate an iframe easily (height: 30em; width: 30em; border: solid black 1px; overflow: auto;), then you can use a preprocessor (http://www.cs.tut.fi/~jkorpela/html/cpre.html - and there are other, less geeky ones) to include common content in each page. Then you get the added benefit of being friendly to Googlebot, Lynx users, Palmtop users and people who want to bookmark a specific article.
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.


Author Comment

ID: 9687392
The Internet Explorer stupidity is a matter of time. I'm not going to stop my progress because of some browser. I've already revised my backdrop a couple of times because IE is too stupid to understand position:fixed. So let's not dive into IE. :)

I can't use preprocessing to include these files, as my files are hosted on a third party host. This host does allow for cgi but afaik not things like php or asp, which both would've been nice in this particular case. So if I can do it without server-side processing or client-side processing, I will. Less code means less mistakes. Of course finding another host is an option, but I like their service and have been hosted by them for a decade.
LVL 17

Expert Comment

ID: 9687476
Preprocessing can happen in a couple of places:


I was suggesting the second option.  You combine the files on your workstation before uploading.
LVL 11

Expert Comment

ID: 9687493
>  When you serve Internet Explorer some application/xhtml+xml it prompts the user to download it.

That depends on the version. IE 6 will display a document tree unless you include a <?xml-stylesheet type="text/css" href="display.css"?> PI with it.

However, there's another issue -- Opera 7 does not support the <script> element for docs served as XML. You can stick scripts on event handler attributes and they'll run, but that's about it. And I'm trying to get rid of event handler attributes in all my docs and use only handlers defined in script.

Personally, while I love the idea of using XHTML, I've gone back to HTML 4.01 Trans or Strict for the time being, as there are too many problems with MSIE's quirks mode and the Opera scripting issue.

Author Comment

ID: 9687575
Ah, I wondered why Opera dropped the scripting. Internet Explorer isn't too happy with my scripts either. Only Mozilla varieties will run the scripts flawlessly.

As for the preprocessing: The idea of using a frame is that only the contents of that frame is sent and loaded. The entire backdrop remains, already loaded, in the browser. Otherwise combining the backdrop with each article wouldn't have been a problem.

Author Comment

ID: 9693549
Dorward, thank you for the link to Juicy. Their information and examples work perfectly. My testcase pages validated successfully against the Juicy iframe dtd.

As soon as the world's most used browser gets its act straight, I'll implement it in my site. As for now, I'll keep using xhtml1.0 transitional.

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Mobile page Scrolling down when refreshing 4 63
How do I pull the base url for use in html links 7 31
Can't get second accordion on page to work 2 13
Html value of radio 14 27
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question