RKh
RKh

Reputation: 14161

Which is the new recommended standard of HTML & JavaScript?

Of the following:

HTML, XHTML, DHTML

which one is the present standard? Which one to use for better browser compatibility?

Similarly, what are the recommendations for JavaScript and Ajax? Edited:

I design my applications using Aptana Studio. How to know which version of HTML/JavaScript/Ajax it is using and how to change it?

Upvotes: 4

Views: 699

Answers (14)

Steve Rowe
Steve Rowe

Reputation: 19413

HTML 4.01 is the current HTML standard. You can use XHTML if you want to be more "pure" but HTML should be fine. DHTML is not a replacement for HTML. It is an addition which allows you to manipulate objects from JavaScript and move them around.

Upvotes: 0

Chris Fulstow
Chris Fulstow

Reputation: 41882

XHTML 1.0 (Strict or Transitional). And for JavaScript and Ajax use jQuery. It will handle most cross-browser compatibility issues.

Upvotes: -1

SamGoody
SamGoody

Reputation: 14468

HTML5

The markup is basically HTML4 with a support for a few extra tags. And microformats. [The general rule is that anything which is new to HTML5 is and will be supported by Firefox, Safari/Chrome/Webkit and Opera. IE will continue to improve its support for HTML4 for the foreseeable future, but always with a buggy implementation.]

Use the following doctype:

<!doctype html>
<html>
<head>...

This (HTML5 doctype) is not only short and easy to read for yourself, it is becoming the de facto standard. It is understood and handled correctly by all browsers (except Internet Explorer 6, which translates it to XHTML4 Strict, also a perfectly valid doctype.)

This is the doctype/language used by Google on all of their pages. A comment by Cutts led me to think it may help a teeny bit in SEO.

The W3C validator for HTML 5 is still beta, but it is available: http://validator.w3.org/#validate_by_uri+with_options

DHTML is not a language, it is a reference to a collection of technologies. XHTML5 does exist, and can be used, but the "experts" are pushing against it.

Upvotes: 1

beseku
beseku

Reputation: 915

Regarding Doctypes ... what samgoody says. Using HTML 5 gives all of the compatibility of HTML 4.01, with the added benefits that you can implement more forward facing attributes/elements as and when you see fit, and you can use XHTML style closing tags if you like them, (I do). There are literally no drawbacks to adopting an HTML 5 doctype.

Upvotes: 1

Franci Penov
Franci Penov

Reputation: 76001

For markup, I would suggest HTML 4 or XHTML 1.0/1.1. However, if you want to use XHTML 1.1, you have to deliver it as application/xml, which does not work under Internet Explorer and you can't use some of the most used external tools that inject fragments on your page, like AdSense for example. HTML 5 is not fully supported by any browser, and there's no official standard for it yet, so any support might change in future.

For scripting, use ECMAScript 3. ECMAScript 4 was abandoned, and ECMA Script 5 is not yet supported by most of the implementations our there.

For Ajax, stick with XMLHttpRequest Level 1. Level 2 is still a working draft and I am not sure which browsers have support for it.

Update: I don't know how you can force Aptana to a particular (X)HTML version through its settings, but if you have access to the raw document, you can add the proper DTD (<!DOCTYPE>) for the markup you want and Aptana should obey by it. THe DTDs for HTML 4.0 and XHTML 1.0 are as follow (pick only one):

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

(I am sure that Aptana also has this as a choice somewhere in the dialogs/menus when you create a new document and it will add the proper DTD based on that choice.)

To choose the proper version of ECMAScript, just put your scripts into a non-versioned script tag (<script type="text/javascript"> - see note). This MIME type is associated with JavaScript 1.5/ECMAScript 3.

As for the proper XMLHttpRequest, I would suggest (as others did in their answers) using jQuery or any other JavaScript framework (Dojo, Prototype and so on) to take care of doing the right thing on each browser. Aptana comes with most of these JavaScript frameworks out of the box, so you just have to choose the one you want to use. My personal preference is jQuery.

Note: according to IANA (RFC4329) the text/javascript MIME type on the <script> element is obsolete and should be replaced by application/javascript or application/ecmascript. However, the latter are not supported by Internet Explorer.

Upvotes: 13

Konamiman
Konamiman

Reputation: 50273

For better current browser compatibility I would stick to either HTML 4 or XHTML, since HTML 5 is still a draft and current support is experimental.

For JavaScript/Ajax, I would recommend using a good helper library. jQuery is a very good one and one of the most widely used.

Upvotes: 0

rahul
rahul

Reputation: 187040

I think it is

HTML 4.01.

which is mostly supported by all browsers.

Also Aptana is just a document editor and you have full control over the version specified for you HTML and JavaScript.

Also Ajax is not a technology and I don't think there is an official version number for Ajax. Although Ajax implementation by each vendor may have one.

Upvotes: 1

DMI
DMI

Reputation: 7191

DHTML isn't a standard as such -- it's just a combination of (X)HTML and JavaScript. The standard with the most momentum behind it is HTML5, as Asaph said. JavaScript itself (properly known as ECMAscript) is also developing fast, with a version 1.6 document being released recently.

Many people suggest using XHTML, but you technically have to violate the standard in order to get it to work across browsers. If you are just looking for current compatibility, then HTML4 is well-supported, and parts of HTML5 are beginning to appear in some browsers. Having said that, I would definitely plan for everyone to use HTML4, and then enhance the site for those with HTML5.

Upvotes: 1

Paul D. Waite
Paul D. Waite

Reputation: 98796

HTML and XHTML are the same language, with slightly different syntaxes.

It really doesn’t matter.

Upvotes: -1

Mickel
Mickel

Reputation: 6696

HTML5 is not widely used across all modern browsers yet (a lot of the standards are not yet implemented).

Because of this, I'd say that XHTML 1.1 is recommended for todays use.

Edit: You set the version of your document in the doctype-declaration.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

Upvotes: 1

DoctorLouie
DoctorLouie

Reputation: 2674

Plain and simple... HTML 4.01 is your best bet for forward and backward compatibility. Considering the fact that XHTML has it's limited browser compatibilities, there's no reason to code strictly with this markup especially if you can have the same functionality, look and feel using a tried and tested markup such as HTML 4.01. New technologists in the development arena will refute this but this is due to their misunderstanding of HTML 4.01 and its abilities, especially since they have been brought up with the strict use of XHTML.

Always think about forward as well as backward compatibility for at least 2 browser versions into the past. Furthermore, test all your code on Opera, Firefox, MSIE, Safari and Chrome to get the best feel for true cross-browser compatibilities, this will help you determine the best markup for the job at hand. Which will indeed be, HTML 4.01.

Upvotes: 4

Gumbo
Gumbo

Reputation: 655239

Virtually there didn’t happen much since HTML 4.01 in 1999. The majority of browsers do not support much more hypertext markup features than in HTML 4.01.

XHTML 1.0 is just the XML compatible counterpart to HTML 4.01. XHTML 1.1 is a stricter form of XHTML 1.0 and the development of XHTML 2 has been aborted in favor of HTML 5. That’s currently the most promising development in hypertext markup languages, but it’s still a working draft.

So for HTML the current recommendation is HTML 4.01 and for XHTML it’s XHTML 1.1. But XHTML 1.1 requires to be sent as XML and most browsers do have difficulties with this. So it’s rather XHTML 1.0 that has the lead in the XHTML brance since it’s allowed to also be sent as plain HTML.

Upvotes: 1

phoebus
phoebus

Reputation: 14931

DHTML is not a standard, it's just an umbrella term for dynamic controls using a mixture of HTML, JavaScript, CSS, etc. Most sites include something that you could reasonably call "DHTML".

HTML5, while promising and the "next big thing", is definitely not implemented across browsers yet. If you need compatibility with a variety of user agents, that is not the way to go.

For maximum compatibility, HTML4 is sort of the gold standard at this point. XHTML 1.1 is also a good way to go, although it probably has a few more quirks than HTML4 at the moment. It really depends on your needs and preferred style between the two.

Upvotes: 2

Isaac
Isaac

Reputation: 16382

If you want the best support in all current browsers, HTML5 probably isn't the way to go yet.

HTML 4.01 is ok, and XHTML 1.1 is good.

YMMV, but I've gotten a lot out of XHTML, myself.

Upvotes: 1

Related Questions