You are here: Re: cdata and javascript « HTML « IT news, forums, messages
Re: cdata and javascript

Posted by cwdjrxyz on 10/01/61 12:01

On Jan 27, 5:41 pm, A-OK-SITE <aoksi...@gmail.com> wrote:
> On Jan 27, 3:46 pm, "Jukka K. Korpela" <jkorp...@cs.tut.fi> wrote:
>
>
>
> > Scripsit Jeff:
>
> > > I have a bit of javascript that I'd like to hide from the validator.
>
> > Consider learning what a validator is before trying to fool it.
>
> > Then read the validator's FAQ list when you run into problems.
>
> > And if you use JavaScript, just put any bulky code into an external
> > file, and any validation issues with it vanish in a puff of logic.
>
> > > Should I be using XHTML [...]?
>
> > No, especially since you asked.
>
> > --
> > Jukka K. Korpela ("Yucca")http://www.cs.tut.fi/~jkorpela/
>
> Jeff,
>
> Everybody seems to have a preference as to which doc type they prefer
> html or xhtml and most of it has no basis in reality. It is like the
> old Ford vs Chevy argument in which both are good but for some reason
> people just seem to like one more than the other.
>
> XHTML is a cleaner code with features like self-closing tags (et al).
> The XHTML is almost always served and interpreted as HTML with the
> main difference being the syntax only. The new HTML 5.0 and XHTML 2.0
> that is soon to be released is bringing the two types even closer
> together based on preliminary information. It is also somewhat like
> the difference between strict and transitional and both will render
> the page the same with only minute differences in the way the page is
> coded.
>
> So in summary pick the language you feel the most comfortable with and
> use it. They are both valid and fully functional, and all modern
> browsers will render the code just fine. It is just my humble opinion
> but I prefer XHTML, but I always preferred a Chevy and a Budweiser
> too.

Unfortunately no IE browser, including IE7, can render any xhtml if it
is served properly as mime type application/xhtml+xml. All you get is
an error message. Many mis-serve xhtml as text/html and use an
extension .html. Although this often works for IE browsers, there is
no point in writing xhtml code in the first place if you are not going
to serve it as xhtml. Since the extension .html usually is associated
with the mime type for text/html on the server, you have to use
another extension, such as .xhtml, and assign it to the xhtml mime
type application/xhtml+xml on the server. Then when you serve xhtml
properly, in addition to IE browsers not working, other modern
browsers such as Firefox, Opera, Seamonkey, and Safari for Windows
will handle true xhtml. However then the code is parsed as xml. A xml
parser must be much more strict than a html parser. The least little
mistake, such as a single unclosed tag, gives a fatal parse error that
results in an error message rather than a view of the page, which
often works with little problem in html.

If you want to serve true xhtml, you have to provide IE html by using
separate pages, header/browser exchange and rewriting the page for
html for browsers that do not indicate they can handle the mime type
for xhtml, etc. The main reason for all of this trouble is that
Microsoft can not or will not write their browsers to handle modern
xhtml properly. Hopefully, now that Vista is out after much delay,
Microsoft will have time to bring their browser up to date. IE7 was
just a minor change from IE6. It did correct some bugs and might be a
bit more secure. However it was outmoded at the moment it was
released.

The important thing to remember is that you have xhtml only if both
the code is written in xhtml and it is served as application/xhtml+xml
- not text/html. The W3C validator only validates the code as html or
xhtml. It does not validate that the code is being served properly.
However, in the most detailed setting of the validator, it will tell
you if the page is being served as text/html or application/xhtml+xml.
You will find very few pages being served properly as xhtml when you
check them.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация