By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,813 Members | 1,236 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,813 IT Pros & Developers. It's quick & easy.

Creating XHTML in an iframe

P: n/a
I am trying to find a way to load XHTML content in an Iframe.

I use to do this in html by using the following code :

var iframeObject = document.createElement("iframe");
MyDiv.appendChild(iframeObject);
var data =
"<html><head><title>testing</title></head><body>data</body></html>"
iframeObject.contentDocument.open();
iframeObject.contentDocument.writeln(data);
iframeObject.contentDocument.close();

This works fine. I can create my content dynamicly and synchroniously.
No problem.

No I try to switch to XHTML, but have trouble getting th eiframe to
understand that it gets XHTML data. It simply assumes that the data is
"text/html".
I tried to add the contentType with the .open() arguments:

var iframeObject = document.createElement("iframe");
MyDiv.appendChild(iframeObject);
var data = "<!DOCTYPE html PUBLIC \"-//W3C//DTD ..etc..
transitional.dtd\">"
+ "<html xmlns=\"http://www.w3.org/1999/xhtml\" > etc etc </html>";
iframeObject.contentDocument.open("application/xhtml+xml", true);
iframeObject.contentDocument.writeln(data);
iframeObject.contentDocument.close();

The code runs but the content is not seen as xhtml, so I can't mix html
and xml. Someone gave me the hint to use the following:

iframeObject.src="data:application/xhtml+xml,"+data;

This works, the data gets loaded and is actually seen as xhtml, but..
the loading happens async in stead of sync.

Is there anyone who can help me with :
- does document.open("application/xhtml+xml", true) work at all?
should it work ?
- are there other ways to wait for an async loading in scripting ?

Kees

Aug 26 '05 #1
Share this Question
Share on Google+
16 Replies


P: n/a


Mcginkel wrote:

Is there anyone who can help me with :
- does document.open("application/xhtml+xml", true) work at all?
should it work ?
If you really have used script and application/xhtml+xml before then you
probably know that current browsers (at least Mozilla and Opera) do not
support document.write for that content type. And I don't think there is
any intention to support it.
So the problem is not simply the document.open call but the
document.write calls that would follow.
- are there other ways to wait for an async loading in scripting ?


Mozilla allows an onload handler on an iframe element so you could try alike

var div = document.createElement('div');
var iframe = document.createElement('iframe');
div.appendChild(iframe);
document.body.appendChild(div);
iframe.onload = function (evt) {
alert(evt.type + '; target: ' + evt.target + '; currentTarget: ' +
evt.currentTarget);
if (evt && evt.currentTarget && evt.currentTarget.contentDocument) {
var element = evt.currentTarget.contentDocument.documentElement;
alert('nodeName: ' + element.nodeName + '; namespaceURI: ' +
element.namespaceURI);
}
};
iframe.src = 'data:application/xhtml+xml,' + [
'<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">',
'<head>',
'<script type="text/javascript">',
'window.onload = function (evt) { alert(\'document: \' + document +
\'; contentType: \' + document.contentType); };',
'<\/script>',
'</head>',
'<body>',
'<h1>test</h1>',
'</body>',
'</html>'
].join('');

Mozilla (tested with 1.7) shows the contentType as application/xhtml+xml
for the document in the iframe and nodeName/namspaceURI are also as they
should be in an XHTML document (lower case nodeName, namespace
http://www.w3.org/1999/xhtml).

Note that for that data: URL the iframe src is set to I have just
followed your example but I would need to check the data URL
specification and check whether the string needs to be URL encoded
before using that stuff in the praxis.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Aug 26 '05 #2

P: n/a
>If you really have used script and application/xhtml+xml before then you
probably know that current browsers (at least Mozilla and Opera) do not
support document.write for that content type. And I don't think there is
any intention to support it.
So the problem is not simply the document.open call but the
document.write calls that would follow.


I know that you cannot use write() while parsing an xhtml document. I
just assume I can write a new document once into another window or
frame. so not modifying the original doc. Is that outside the scope of
the spec ?

Thanks for the example, but it is still an async notification when the
frame is ready loading. In my code I load a library with functions, I
will use the functions directly after the call document.close() or
..src="data:.......". I am stuck with some old code that works fine in
IE and HTML. Now I try to move to XHTML and supporting other browsers.
I hoped to find a way without rewriting the code too much.

As you have worked with XHTML. Is it worth migrating to ? The main
reason to change is the option to mix html with xml (simular to
dataislands in IE) and svg. The opinions on XHTML are quite diverse,
depending on who you speak. Is it solid enough to build appliactions in
a browser ?

Kees

Aug 26 '05 #3

P: n/a
Mcginkel schrieb:
If you really have used script and application/xhtml+xml before then you
probably know that current browsers (at least Mozilla and Opera) do not
support document.write for that content type. And I don't think there is
any intention to support it.
So the problem is not simply the document.open call but the
document.write calls that would follow.

I know that you cannot use write() while parsing an xhtml document. I
just assume I can write a new document once into another window or
frame. so not modifying the original doc. Is that outside the scope of
the spec ?

Thanks for the example, but it is still an async notification when the
frame is ready loading. In my code I load a library with functions, I
will use the functions directly after the call document.close() or
..src="data:.......". I am stuck with some old code that works fine in
IE and HTML. Now I try to move to XHTML and supporting other browsers.
I hoped to find a way without rewriting the code too much.

As you have worked with XHTML. Is it worth migrating to ? The main
reason to change is the option to mix html with xml (simular to
dataislands in IE) and svg. The opinions on XHTML are quite diverse,
depending on who you speak. Is it solid enough to build appliactions in
a browser ?

Kees


Can't answer your questions but one thing to remember on using iframes in XHTML:
There is no iframe anymore in XHTML, so you shouldn't switch to XHTML when you
want to use iframes.
Aug 26 '05 #4

P: n/a


Martin Kurz wrote:

Can't answer your questions but one thing to remember on using iframes in XHTML:
There is no iframe anymore in XHTML, so you shouldn't switch to XHTML when you
want to use iframes.


That is nonsense, XHTML 1.0 is simply a reformulation of HTML 4 so it
has all the elements like <iframe>, <frameset>, <frame> and the target
attribute if you use the proper XHTML 1.0 DTD:
<http://www.w3.org/TR/xhtml1>

--

Martin Honnen
http://JavaScript.FAQTs.com/
Aug 27 '05 #5

P: n/a


Mcginkel wrote:
I know that you cannot use write() while parsing an xhtml document. I
just assume I can write a new document once into another window or
frame. so not modifying the original doc. Is that outside the scope of
the spec ?
It is hard to find anything definitive in the spec, if we look at the
W3C DOM Level 2 HTML module then it defines a method document.write for
both HTML 4 and XHTML 1.0 documents as the introduction in
<http://www.w3.org/TR/DOM-Level-2-HTML/> says:
"This specification defines the Document Object Model Level 2 HTML, a
platform- and language-neutral interface that allows programs and
scripts to dynamically access and update the content and structure of
[HTML 4.01] and [XHTML 1.0] documents."
and as the specification of document.write in
<http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-75233634> does to
list any exceptions that for XHTML 1.0 the method is not supposed to be
supported.
The specification of the open method here
<http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-72161170> does not
list any parameters and only speaks of strings of unparsed HTML.
So in terms of the W3C DOM the open method has no parameter to set a
MIME type.

As you have worked with XHTML. Is it worth migrating to ? The main
reason to change is the option to mix html with xml (simular to
dataislands in IE) and svg. The opinions on XHTML are quite diverse,
depending on who you speak. Is it solid enough to build appliactions in
a browser ?


My work with XHTML has been mostly experimental to explore the
differences between scripting HTML and XHTML and XML documents. My
conclusion so far is that it is not worth to bother with pure XHTML 1.0
as a replacement for HTML 4.01 as there are no advantages in terms of
HTML (XHTML 1.0 is a reformulation of HTML 4.01 and thus has the same
elements and attributes) and as writing XHTML 1.0 so that it is
backwards compatible with HTML is a hassle. With at least one major
browser (that is IE/Win) having no support for XHTML being served as
application/xhtml+xml if you want to use XHTML 1.0 you are however
forced to write in so it is backwards compatible to HTML and can be
served as text/html.
There are some people by now who use the HTTP accept header the user
agent sends to send XHTML 1.0 as text/html then to IE but as
application/xhtml+xml to browsers like Mozilla or Opera.
Scripting then even becomes more difficult as you have to write your
scripts so that they work in both environments.

And there are documented disadvantages, for instance the Mozilla web
devloper FAQ
<http://www.mozilla.org/docs/web-developer/faq.html#xhtmldiff> clearly
explains "The document is not loaded and rendered incrementally. That
is, the document is displayed only after the entire document has been
received and parsed."

So on the web in general I see no reason why you should use XHTML 1.0
instead of HTML 4.01.
If you were authoring for an intranet where you know all users using the
latest version of a browser supporting XHTML as application/xhtml+xml
you could of course decide differently, you do not have the hassle of
needing to write markup that both HTML/SGML and XHTML/XML parsers
understand and the hassle of writing scripts working in both environments.
Things are different when it comes to real advantages XHTML and XML has
to offer, you have named the integration of XHTML with other XML
applications like SVG or like MathML. There it certainly makes sense to
use XML but of course it is hardly possible to write applications for
the web in general that case, these are (at least currently) niche
applications requiring a particular user agent. Mozilla (since 1.0 I
think) can do XHTML 1.0 with MathML, Opera (since 8.0) can do XHTML 1.0
with SVG Tiny I think where script in the SVG is not supported, where no
SVG DOM is exposed, and where Core DOM manipulation of the SVG elements
at run time are not working reliably. The upcoming Firefox 1.5 will
allow mixed XHTML, MathML, SVG with scripting of SVG and some SVG DOM
exposed but obviously then writing for instance a mixed XHTML and SVG
document that works the same in Firefox 1.5 and Opera 8 needs a
developer carefully using features implemented by both browsers.
If you think XHTML helps to have then XML data islands in the HTML
document then I still think using HTML 4 and text/html for your HTML
document with script and then using your script and XMLHttpRequest to
load/parse the XML data gives you a broader browser support and easier,
more consistent scripting.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Aug 27 '05 #6

P: n/a
Martin Honnen schrieb:


Martin Kurz wrote:

Can't answer your questions but one thing to remember on using iframes
in XHTML:
There is no iframe anymore in XHTML, so you shouldn't switch to XHTML
when you
want to use iframes.

That is nonsense, XHTML 1.0 is simply a reformulation of HTML 4 so it
has all the elements like <iframe>, <frameset>, <frame> and the target
attribute if you use the proper XHTML 1.0 DTD:
<http://www.w3.org/TR/xhtml1>


So it would be nice to point me to the iframe in the strcit-dtd:
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
There's no Element iframe.
Aug 27 '05 #7

P: n/a

Martin Honnen wrote:
Mcginkel wrote:
I know that you cannot use write() while parsing an xhtml document. I
just assume I can write a new document once into another window or
frame. so not modifying the original doc. Is that outside the scope of
the spec ?


It is hard to find anything definitive in the spec, if we look at the
W3C DOM Level 2 HTML module then it defines a method document.write for
both HTML 4 and XHTML 1.0 documents as the introduction in
<http://www.w3.org/TR/DOM-Level-2-HTML/> says:
"This specification defines the Document Object Model Level 2 HTML, a
platform- and language-neutral interface that allows programs and
scripts to dynamically access and update the content and structure of
[HTML 4.01] and [XHTML 1.0] documents."
and as the specification of document.write in
<http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-75233634> does to
list any exceptions that for XHTML 1.0 the method is not supposed to be
supported.
The specification of the open method here
<http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-72161170> does not
list any parameters and only speaks of strings of unparsed HTML.
So in terms of the W3C DOM the open method has no parameter to set a
MIME type.

As you have worked with XHTML. Is it worth migrating to ? The main
reason to change is the option to mix html with xml (simular to
dataislands in IE) and svg. The opinions on XHTML are quite diverse,
depending on who you speak. Is it solid enough to build appliactions in
a browser ?


My work with XHTML has been mostly experimental to explore the
differences between scripting HTML and XHTML and XML documents. My
conclusion so far is that it is not worth to bother with pure XHTML 1.0
as a replacement for HTML 4.01 as there are no advantages in terms of
HTML (XHTML 1.0 is a reformulation of HTML 4.01 and thus has the same
elements and attributes) and as writing XHTML 1.0 so that it is
backwards compatible with HTML is a hassle. With at least one major
browser (that is IE/Win) having no support for XHTML being served as
application/xhtml+xml if you want to use XHTML 1.0 you are however
forced to write in so it is backwards compatible to HTML and can be
served as text/html.
There are some people by now who use the HTTP accept header the user
agent sends to send XHTML 1.0 as text/html then to IE but as
application/xhtml+xml to browsers like Mozilla or Opera.
Scripting then even becomes more difficult as you have to write your
scripts so that they work in both environments.

And there are documented disadvantages, for instance the Mozilla web
devloper FAQ
<http://www.mozilla.org/docs/web-developer/faq.html#xhtmldiff> clearly
explains "The document is not loaded and rendered incrementally. That
is, the document is displayed only after the entire document has been
received and parsed."

So on the web in general I see no reason why you should use XHTML 1.0
instead of HTML 4.01.
If you were authoring for an intranet where you know all users using the
latest version of a browser supporting XHTML as application/xhtml+xml
you could of course decide differently, you do not have the hassle of
needing to write markup that both HTML/SGML and XHTML/XML parsers
understand and the hassle of writing scripts working in both environments.
Things are different when it comes to real advantages XHTML and XML has
to offer, you have named the integration of XHTML with other XML
applications like SVG or like MathML. There it certainly makes sense to
use XML but of course it is hardly possible to write applications for
the web in general that case, these are (at least currently) niche
applications requiring a particular user agent. Mozilla (since 1.0 I
think) can do XHTML 1.0 with MathML, Opera (since 8.0) can do XHTML 1.0
with SVG Tiny I think where script in the SVG is not supported, where no
SVG DOM is exposed, and where Core DOM manipulation of the SVG elements
at run time are not working reliably. The upcoming Firefox 1.5 will
allow mixed XHTML, MathML, SVG with scripting of SVG and some SVG DOM
exposed but obviously then writing for instance a mixed XHTML and SVG
document that works the same in Firefox 1.5 and Opera 8 needs a
developer carefully using features implemented by both browsers.
If you think XHTML helps to have then XML data islands in the HTML
document then I still think using HTML 4 and text/html for your HTML
document with script and then using your script and XMLHttpRequest to
load/parse the XML data gives you a broader browser support and easier,
more consistent scripting.
--

Martin Honnen
http://JavaScript.FAQTs.com/


It seems xhtml 1.0, of which there are transitional, strict, and frame
set species, has been the focus of this discussion. Xhtml 1.1 has been
out quite a while now and an even newer version, which will require new
browsers, is in the works. I only code in xhtml 1.1 now and see
absolutely no advantage of using a 1.0 species at this late date. Of
course what html-xhtml version you wish to use is a matter of personal
taste - even html 3.2 still works on most browsers.

It has been claimed that xhtml 1.1 can not be served as html. However,
in many cases this is not true, although there is likely no advantage
in doing so rather than using html 4.01 strict. The W3C just says xhtml
1.1 should not be served as html. However, they say that xhtml must not
be served as html. It is likely that the next version of xhtml will
specify that it must not be served as html. I suspect that the W3C did
not use "must not" for xhtml 1.1 because of IE6 and relatives that can
not accept the mime type application/xhtml-xml.

I am serving true application/xhtml+xml in some of my more recent
pages. A simple php include at the very top of the php page detects if
the browser will accept application/xhtml+xml. If so, everything needed
for xhtml 1.1 above the head tag is automatically included in the page.
If the mentioned mime type support is not detected, then code above the
page for html 4.01 strict is written. The php include also uses a
simple regular expression to convert <br /> and such to <br> if an html
page must be used.

When you use xhtml 1.1 served as application/xhtml+xml, browsers that
can handle it become very strict and parse your code as xml. If there
is the least little error, the page does not display and you get a xml
parse error message instead. In general document.write just gives a
blank page or an error message. The xml parser can see right through
script, comment tags, etc. The main xml no-no is anything that is not
closed. The problem with document.write is there is no telling what
this might contain, including unclosed tags and symbols with special
xml meaning. Thus document.write can not be allowed. In some cases you
can build up what you need from the DOM to replace document.write.
However the easy way is to use server side script. For example, I had
one old page where document.write was at the bottom of a nest of 3 if
loops and was executed about 2500 times. It was easy to convert this
portion of the script to a server side php script. Thus the browser is
sent all of the code generated by the document.write php replacement,
and the xml parser has no problem checking all of this code for
unclosed tags, etc. You can also use server side Perl or several other
languages if any of them strike your fancy more than php.

I likely will soon be posting some examples of rather complicated pages
served in both xhtml 1.1 and html 4.01 strict as needed by the viewing
browser. These pages include some server side php script. This will
hopefully make what I discussed above more clear.

Aug 27 '05 #8

P: n/a


Martin Kurz wrote:
Martin Honnen schrieb:

Martin Kurz wrote:
There is no iframe anymore in XHTML, so you shouldn't switch to XHTML
when you
want to use iframes.

That is nonsense, XHTML 1.0 is simply a reformulation of HTML 4 so it
has all the elements like <iframe>, <frameset>, <frame> and the target
attribute if you use the proper XHTML 1.0 DTD:
<http://www.w3.org/TR/xhtml1>

So it would be nice to point me to the iframe in the strcit-dtd:
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
There's no Element iframe.


There is also no iframe element in HTML 4.01 strict so your claim "There
is no iframe anymore in XHTML" is nonsense, if you want to write valid
HTML 4.01 with an iframe then you need to use the transitional HTML 4.01
DTD and if you want to write valid XHTML 1.0 with an iframe then you
need to use the transitional XHTML 1.0 DTD.
There is no change regarding iframes from HTML 4.01 to XHTML 1.0.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Aug 27 '05 #9

P: n/a

cw******@yahoo.com wrote:
It has been claimed that xhtml 1.1 can not be served as html. However,
in many cases this is not true, although there is likely no advantage
in doing so rather than using html 4.01 strict. The W3C just says xhtml
1.1 should not be served as html. However, they say that xhtml must not
be served as html. It is likely that the next version of xhtml will
specify that it must not be served as html. I suspect that the W3C did
not use "must not" for xhtml 1.1 because of IE6 and relatives that can
not accept the mime type application/xhtml-xml.


I reversed two words in a sentence. The statement: " However, they say
that xhtml must not be served as html." should read: " However, they
say that html must not be served as xhtml."

Aug 27 '05 #10

P: n/a
Martin Kurz wrote:
Martin Honnen schrieb:
Martin Kurz wrote: <snip>
There is no iframe anymore in XHTML, so you shouldn't
switch to XHTML when you want to use iframes.


That is nonsense, XHTML 1.0 is simply a reformulation of
HTML 4 so it has all the elements like <iframe>, <frameset>,
<frame> and the target attribute if you use the proper
XHTML 1.0 DTD:
<http://www.w3.org/TR/xhtml1>


So it would be nice to point me to the iframe in the
strcit-dtd:
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
There's no Element iframe.


There is no IFRAME in the strict HTML DTD either (and no other sorts of
frames), but they do exist in the transitional XHTML 1.0 DTD.

Richard.
Aug 27 '05 #11

P: n/a
Martin Honnen wrote:
My work with XHTML has been mostly experimental to explore the
differences between scripting HTML and XHTML and XML documents. My
conclusion so far is that it is not worth to bother with pure XHTML 1.0
as a replacement for HTML 4.01 as there are no advantages in terms of
HTML (XHTML 1.0 is a reformulation of HTML 4.01 and thus has the same
elements and attributes) and as writing XHTML 1.0 so that it is
backwards compatible with HTML is a hassle. With at least one major
browser (that is IE/Win) having no support for XHTML being served as
application/xhtml+xml if you want to use XHTML 1.0 you are however
forced to write in so it is backwards compatible to HTML and can be
served as text/html.


So defy them. Explain to the suckers that they're using a broken browser
sold by criminals, and they should replace it.

--
John W. Kennedy
If Bill Gates believes in "intelligent design", why can't he apply it to
Windows?
Aug 28 '05 #12

P: n/a
John W. Kennedy wrote:
Martin Honnen wrote:

<snip>
.. . With at least one major browser (that is IE/Win) having
no support for XHTML being served as application/xhtml+xml
if you want to use XHTML 1.0 you are however forced to write
in so it is backwards compatible to HTML and can be served
as text/html.


So defy them. Explain to the suckers that they're using a broken
browser sold by criminals, and they should replace it.


That sounds like a good way of becoming unemployed. In the commercial
world if the end results don't work on IE then you haven't done your job
at all.

Richard.
Aug 28 '05 #13

P: n/a
Richard Cornford wrote:
John W. Kennedy wrote:
Martin Honnen wrote:


<snip>
.. . With at least one major browser (that is IE/Win) having
no support for XHTML being served as application/xhtml+xml
if you want to use XHTML 1.0 you are however forced to write
in so it is backwards compatible to HTML and can be served
as text/html.


So defy them. Explain to the suckers that they're using a broken
browser sold by criminals, and they should replace it.

That sounds like a good way of becoming unemployed. In the commercial
world if the end results don't work on IE then you haven't done your job
at all.


OK, but don't complain when your grandchildren have to kiss Lord Gates's
feet.

--
John W. Kennedy
"You can, if you wish, class all science-fiction together; but it is
about as perceptive as classing the works of Ballantyne, Conrad and W.
W. Jacobs together as the 'sea-story' and then criticizing _that_."
-- C. S. Lewis. "An Experiment in Criticism"
Aug 28 '05 #14

P: n/a
John W. Kennedy wrote:
Richard Cornford wrote:
John W. Kennedy wrote:
Martin Honnen wrote:

<snip>
.. . With at least one major browser (that is IE/Win) having
no support for XHTML being served as application/xhtml+xml
if you want to use XHTML 1.0 you are however forced to write
in so it is backwards compatible to HTML and can be served
as text/html.

So defy them. Explain to the suckers that they're using a
broken browser sold by criminals, and they should replace it.


That sounds like a good way of becoming unemployed. In the
commercial world if the end results don't work on IE then
you haven't done your job at all.


OK, but don't complain when your grandchildren have to kiss Lord
Gates's feet.


That would be the style of argument known as the "slippery slope", and
not generally regarded as valid.

Richard.
Aug 29 '05 #15

P: n/a
Can we do the iframe/gates bashing in a seperate forum ? I really
appriciate it when people take the time to answer the questions in this
news group. It is valuable for me.

So to summarize :
- Document.open("...") and document.write are not the supported for
xhtml, not even for the first creation of the document. This leave me
with no way to create an xhtml document in an iframe or window from
scripting (synchronious).
- There are no ways to wait for a completion event (or yield) in
javascript.
- XHTML is not supported by all browsers, so you can use it only when
you can choose which browsers you support. (intranet/company).
- If you use it make sure to set the mimetype differently for IE
(text/html) and mozilla (application/xhtml+xml). Make sure that the xml
is properly formatted and be aware of the suttle differences
(loading/innerhtml etc)

Thanks for the input.
Kees

Aug 29 '05 #16

P: n/a
Mcginkel wrote:
Can we do the iframe/gates bashing in a seperate forum ? I really
appriciate it when people take the time to answer the questions in
this news group. It is valuable for me.

So to summarize :
- Document.open("...") and document.write are not the supported for
xhtml, not even for the first creation of the document. This leave me
with no way to create an xhtml document in an iframe or window from
scripting (synchronious).
It should be fairly obvious why - document.open/write - cannot create a
document of any type; the document object must exist before you can call
any of its methods, and so must already be of some type when that
happens. That is; the distinction between an XHTML and an HTML DOM
applies to the - document - object and all of its descendants in the
browser's object model.
- There are no ways to wait for a completion event (or yield) in
javascript.
This assumption needs to be seriously questioned as it is trivial for
javascript to preserve entire execution contexts, suspending processes
at some point and then resuming them later in response to events or
actions. This is the ability that allows the use of asynchronous
XmlHttpRequsets (and much else aside in an event driven environment that
should be programmed to be asynchronous).
- XHTML is not supported by all browsers, so you can use it only
when you can choose which browsers you support. (intranet/company).
- If you use it make sure to set the mimetype differently for IE
(text/html) and mozilla (application/xhtml+xml). Make sure that the
xml is properly formatted and be aware of the suttle differences
(loading/innerhtml etc)


It is important to note, and seemingly under appreciated, that when a
document is served with the MIME type text/html it is (will be
interpreted as, and must be scripted as) an HTML document, regardless of
any similarities that its mark-up might bare to XHTML (i.e. Appendix C
XHTML 1.0 served as text/html is formally malformed HTML _not_ XHTML
(certainly as far as the receiving browser is concerned)).

Richard.
Aug 31 '05 #17

This discussion thread is closed

Replies have been disabled for this discussion.