Same Origin XMLHttpRequest Test, Version 1

This test demonstrates that iPhone MobileSafari can successfully send a POST request from this page to a resource with the same origin via JavaScript's XMLHttpRequest. But when this same page is posted on a foreign domain, MobileSafari prior to iOS4 fails to send the POST data. See demo.

The Test:
Enter a message below, then click "Send".

Your message:

When you click "Send", JavaScript will send your data to a PHP script on a foreign domain via an XMLHttpRequest object (view the source of this page to see the code). The request should succeed because this page and the target script have the same origin. The PHP script will return your message and your browser's HTTP request headers.

Here is a sample of a successful iPhone request:

You sent:

message=hello there world!

Your request headers: 

User-Agent: Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_1_3 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7E18 Safari/528.16
Content-Type: application/x-www-form-urlencoded
Accept: */*
Accept-Language: en-us
Accept-Encoding: gzip, deflate
Content-Length: 26
Connection: keep-alive

HTTP status code: 200, HTTP status text: OK

Test Output: