Share via


Developing AJAX Applications for Windows Mobile

4/19/2010

The term AJAX is shorthand for a design approach that helps to make web sites more interactive and responsive. A typical AJAX web site utilizes JavaScript to perform client-side processing, makes asynchronous requests for XML data from a remote server, and uses CSS to implement the appearance.

The Internet Explorer Mobile browser supports all of these techniques, and therefore can support AJAX development. For more information about the Document Object Model supported by Internet Explorer Mobile, see Internet Explorer Mobile Reference. For examples of AJAX applications designed for Internet Explorer Mobile, see this Microsoft Web site.

AJAX Support in Internet Explorer Mobile

Microsoft has improved the web browser and added features continuously through each release of Windows Mobile, as summarized below.

Windows Mobile 2003

  • Supports the innerText and innerHTML properties only on div and span elements.
  • Supports scripting of form elements.

Windows Mobile Version 5.0

  • Supports the innerText and innerHTML properties on all elements.

  • Supports the document.all and style object.

  • Does not support the method document.getElementById. The workaround is to declare an ID and use it to obtain the object, like this:

    <div id="mydiv">Some text in a div</div>
    <script>
    mydiv.innerText = "Some replaced text in a div";
    </script>
    

Windows Mobile Version 5.0 with MSFP

  • Supports the commonly-used method document.getElementById by the addition of the Messaging and Security Feature Pack.

Windows Mobile 6

  • Supports expando properties and methods. DOM objects behave like JavaScript objects in that properties and methods can be created on the fly. For example:

    //Javascript object:
    var obj = new Object();
    obj.MyProperty = "Hello World";
    alert(obj.MyProperty); // alerts "Hello World"
    //DOM object:
    window.MyProperty = "Hello World";
    alert(window.MyProperty); // alerts "Hello World"
    
  • Enables creation of any element in script using document.createElement.

  • Enables addition or removal of elements to or from the document tree using element.insertBefore, element.removeChild, element.replaceChild, element.appendChild.

  • Fixes an important issue that had broken feature detection of script object methods.

  • Supports additional properties and methods:

    • document.documentElement [read-only]
    • document.getElementsByTagName
    • document.title is now writeable [was read-only until now]
    • element.parentNode [read-only]
    • element.childNodes [read-only]
    • element.id is now writeable [was read-only until now]
    • element.className [read/write]

See Also

Other Resources

Internet Explorer Mobile Reference