# DHTML RPC Revisited

DHTML RPC allows JavaScript on a webpage to call a remote server without a page reload. Although techniques for RPC have been around almost since the beginning of JavaScript (DynAPI, Brent Ashley), there has been a recent resurgence in popularity coincident with the emergence of several relatively compatible modern DHTML browsers (Mozilla, Safari, Opera, IE) along with many high profile example applications (links to apps, perhaps just google search on XMLHttp/RPC or something).

## Approaches

There are an unfortunately diverse variety of ways to approach DHTML RPC, each with their own unique advantages and disadvantages. For our purposes here, we will focus only on the most robust, flexible, and compatible solutions available for the public internet today.

### XmlHttp

Uses the XMLHttpRequest object, which has become a de-facto standard, to make a synchronous or asynchronous web request. Both GET and POST HTTP methods are widely supported. Although originally designed for XML, any textual format can be retrieved through the responseText property.

Compatibility:
  Mozilla 1.0+, WinIE 5.0+, Safari 1.?+, Opera?+, Konqueror?, OmniWeb?+
Cross-site scripting:
  not allowed
Response types:
  XML, JavaScript, HTML, PlainText

More Information
Return XML example
Return HTML example
Return JavaScript example

### Dynamic Script Element

The DOM is used to dynamically create a new `<SCRIPT>` element with a remote `SRC` attribute. When the element is appended to the document, the browser dutifully downloads and executes the returned JavaScript. Two-way communication is possible by targeting a server-side script and appending querystring parameters.

Compatibility:
  Mozilla 1.0+, WinIE 4.0+, Safari 1.0+, Opera?+, Konqueror?, OmniWeb?+, Mac IE?+
Cross-site scripting:
  allowed
Response types:
  JavaScript

More Information
Example

### Push

Open to contributors...

### Flash

A unique property of the Flash plugin is it's ability to maintain long-term two-way communication with a server via socket connections. A downside is that two-way communication with the DHTML host page is difficult in all platforms. Research will need to be done to see if this should be included or if Push covers it.

Also open to contributors...

## History, URLs, and accessibility

Though DHTML RPC can radically improve the user experience through increased responsiveness, most implementations simultaneously negate those improvements by breaking the back button and the URL bar. These are critical components of the web browsing UI and must be preserved.

More Information