I have implemented a simple AJAX post (through JS XmlHttpRequest object) to a web page in webserver.
However, I observed a weird symptom/issue on default browser in Android OS 2.X That is, if for some reason there is long enough delay for the webserver to come back with a response (can be simulated by hard coding Thread.Sleep in the web page), the browser would automatically re-post the same request to the webserver again during the wait.
<script type="text/javascript">
$(document).ready(function() {
PerformRequest();
});
function PerformRequest() {
appendMessage('PerformRequest... ');
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("POST", "http://localhost/DelaySite/Default.aspx", true);
xmlhttp.onreadystatechange = function()
{
appendMessage("xmlhttp.readyState: " + xmlhttp.readyState, true);
appendMessage("xmlhttp.status: " + xmlhttp.status, true);
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
// successful response
}
}
xmlhttp.send();
}
</script>
Has anyone seen this issue in Android browser? If so, does anyone know the cause?
Isn't this to be considered as a security issue? Consider case where each request can be possibly made twice if there is long enough network delay between mobile and the host.
However, I can't replicate this issue in ICS, only in Android OS 2.X
Regards,
Oliver