iframe in xhtml1.1 how-to?


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?

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
OmegaJuniorAuthor Commented:
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.
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.
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

OmegaJuniorAuthor Commented:
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.
Preprocessing can happen in a couple of places:


I was suggesting the second option.  You combine the files on your workstation before uploading.
>  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.
OmegaJuniorAuthor Commented:
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.
OmegaJuniorAuthor Commented:
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.