Inconsistent blocking window.prompt behavior on a mobile device
<script type="text/javascript"> var x = prompt("enter x"); var y = prompt("enter y"); alert(x + " " + y); </script> This very simple code asks the user for x , then for y , and then displays a warning with both values. In desktop browsers, this works fine because window.prompt and window.alert blocked.
When viewed through a mobile device (user agent at the end of this message), the first invitation is blocked, but when I click โOKโ, the second invitation does not block, so a warning appears with the following message (suppose I entered 5 in the first invitation):
5 null Why is this happening? Can this be solved?
Real-time example: http://jsfiddle.net/YEA5w/
Mozilla / 5.0 (Linux; U; Android 2.3.5; en-gr; HTC_WildfireS_A510e Build / GRJ90) AppleWebKit / 533.1 (KHTML, like Gecko) Version /4.0 Mobile Safari / 533.1
To record on my Samsung Galaxy S2 both in stock and on Firefox browsers, your violin is great for me.
If you still have problems, you can probably use setTimeout or setInterval to constantly check to see if these prompts have been populated and whether to warn them if there are any.
Sort of:
<script> var x = false; var y = false; var timer = setInterval(function(){ if(x !== false && y !== false) { alert(x + " " + y); clearInterval(timer); } },100); x = prompt("enter x"); y = prompt("enter y"); </script>