AHAH

AHAH

Asynchronous HTML and HTTP, or AHAH, is a method for updating webpages dynamically using Javascript, similar to Ajax, but with the difference that the response from the request is used directly without parsing on the clientside. This means that server responses need to be text or already include valid XHTML/HTML structure. It is also known as the microformat rest/ahah.

Introduction

Like Ajax, the XMLHttpRequest functionality is used to initiate a request, but the state-change of the request when the response is received is directed to a function which does not parse the response as XML using the Document Object Model, but rather inserts the response directly into the intended target element of the document using the non-standard "innerHTML" attribute of elements. The "innerHTML" is a read-/writeable attribute which is supported by the major web browsers (or user agents), and was first introduced in Microsoft's Internet Explorer.

Considerations

A best practice approach to using AHAH is that if you are not going to modify the content structure of the XMLHTTP response further, then it is most often recommendable because of ease of use, lesser complexity, improved speed and improved code readability. The "innerHTML" attribute is also widely supported, although it is not part of the W3C DOM recommendations.

However, if changes to the response XHTML structure beyond any simple string operations are needed, a DOM centric approach as in Ajax is preferable since references to elements based on the response contents, which then have been appended to the target element, have already been created - and can thus be reused. This consideration will vary from case to case, however, since the complexity of the structure and frequency of changes will dictate performance variations.

Firefox 1.5 will only allow valid element structure being set with "innerHTML", while Firefox 2, Opera 8.54 and Internet Explorer 6 & 7 will currently allow any string.

Also, speed is much improved by using "innerHTML" over manipulating the DOM, and some extensive benchmarks have been performed to prove this.Fact|date=July 2008 So, this might warrant the use of AHAH over Ajax in some cases.

Unfortunately, none of the major web browsers normally return valid XML from "innerHTML", even if the document type is set to XHTML 1.0 Strict which demands valid XML in the first place. This means that considerably more processing is needed to massage the mangled string-representation from "innerHTML" into valid XML. Currently, the major web browsers all return different variations of the underlying document elements when using "innerHTML"; Firefox 1.5 fails to close single elements like "img", "br", "input" and so on - while Opera 9.0 returns element names uppercased - finally Internet Explorer fails on both the former as well as omitting the standard required "quotes" around attribute values. In the case of Opera and Firefox it is just one omission each - and hopefully it will get fixed soon. Meanwhile, developers must fix the innerHTML output before processing it further.

Another use of innerHTML is relaying it to Flash via ActionScript and its "ExternalInterface" calling Javascript-functions in the main document. This requires valid XML for parsing, and can be used to avoid loading external content via Flash, but rather include it in the main document structure for replacement or Flash representation. This would also help in SEO-efforts.

tandardization

AHAH has been adopted as part of the REST-Enabled XHTML (REX) microformat. The methods for implementing AHAH have also been made available in Javascript libraries, and also have the advantage of being small in terms of code size.

AHAH functionality is also built into the w3c XForms recommendation standard. XForms uses a Model-view-controller architecture to allow any form events to fetch server XML data into a form instance data with no need for Javascript coding.

External links

* [http://microformats.org/wiki/rest/ahah AHAH microformat description, microformats.org]
* [http://www.quirksmode.org/dom/innerhtml.html innerHTML vs DOM-manipulation benchmarks on various browsers, quirksmode.org.]
* [http://www.gizax.it/ahahsection/ AHAH experiments, gizax.it]


Wikimedia Foundation. 2010.

Игры ⚽ Нужна курсовая?

Look at other dictionaries:

  • AHAH — (Asynchronous HTML and HTTP) это родственный AJAX подход для динамического обновления веб страниц, используя JavaScript. Основным его отличием от AJAX является то, что ответы сервера должны быть обычным HTML. Преимущество подхода заключается в… …   Википедия

  • ahah — ⇒AH, AHA, AHAH, interj. et subst. masc. I. Interjection A. Interjection qui, dans la langue parlée et dans le discours écrit qui la reflète, sert à marquer, avec l aide d intonations appropriées (que l écriture note uniformément par un point d… …   Encyclopédie Universelle

  • Ahah (disambiguation) — Ahah can refer to:*AHAH a method for updating webpages. *Ahah (Book of Mormon) A Jaredite king, son of Seth and father of Ethem. * ahah a word in ancient Egyptian, meaning warrior …   Wikipedia

  • Ahah (Book of Mormon) — This article is about the Book of Mormon Jaredite. For the Book of Mormon Nephite soldier, see Aha (Book of Mormon). For other uses, see AHA, and Ahah. According to the Book of Mormon, Ahah was a Jaredite king that lived in the ancient Americas.… …   Wikipedia

  • ahaḥ — अहः …   Indonesian dictionary

  • ahaḥ-pati — अहःपति …   Indonesian dictionary

  • ahaḥ-sahasrá — अहःसहस्र …   Indonesian dictionary

  • ahaḥ-sāmán — अहःसामन् …   Indonesian dictionary

  • ahaḥ-saṉsthā́ — अहःसंस्था …   Indonesian dictionary

  • ahaḥ-ṡesha — अहःशेष …   Indonesian dictionary

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”