An iframe can be used to perform remote scripting that works on older browsers. This is not the only means; you may want to checkout a method using the xmlHttpRequest object. This object is supported new browsers. A general introduction to remote scripting provides some background and rationale. It's a quick read.

The code has been completely changed to mimic the XHR object. Either an iframe or XHR object can be used without changing the interface code.

Overview

An invisible iframe is used to communicate with the server. Support for this is good on many older browsers. Assigning a URL to the src property of an iframe generates a HTTP GET request. GET appends data—RPC arguments—to the URL as a query string.

The URL is usually a server-side script that does some processing before returning an HTML page containing the response data. When the iframe loads the page, it calls a callback function passing the data to code in the main page.

Here are some features of this code.

The easiest way to get into the is by examining the Web Page loaded into the iframe. So that's the next page.

The original code, available at the end of this tutorial, was tested on IE5.0, 5.5 and 6.0, Netscape 6.x and 7.x, Konqueror 3.2.3, Mozilla 1.7.x, FireFox, and Opera 7.x.

This version has been tested on FireFox 1.5, 2.0 (Windows, Mac, Linux); Safari 2.04, 3.04 Mac; Safari 3.0.3 Windows; IE 5.0, 5.5, 6.0 and 7.0—it needs some tweaks for 5.0.

It did not works on Opera versions prior to 7.