iPhone pop-up choice window
Having fun with auto detection on the iPhone and then presenting the user with the choice of jumping directly to the app store and the application of choice.
if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {
input_box = confirm("Would you like to download Carl's favourite iphone application?");
if (input_box == true) {
// Output when OK is clicked
window.location = "itms://itunes.apple.com/us/app/angry-birds-hd/id364234221?mt=8";
}
else {
}
}
Firstly
Detect iPhone Safari
if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {}
Next
Declare confirmation box, input_box
input_box = confirm("Would you like to download Carl's favourite iphone application?");
Lastly
Capture button clicked
if (input_box == true) {
// Output when OK is clicked
window.location = "itms://itunes.apple.com/us/app/angry-birds-hd/id364234221?mt=8";
} else { // Run cancel process code }
For working example see my portfolio site;
http://www.carlbruiners.co.uk/iphonedetectiondemo.htm
*Note: works only when view through iPhone, feel free to rip the page down using a desktop browser, or using FF change the HTTP agent to view iPhone output.
After Googling for 10 minutes I got fedup with crap tech tutorials, lack on consistancy, so I knocked up the above.
I specialise in all things Agile (XP, Kanban, Lean), in particular Scrum. I have a passion for taking on 'problem' projects / teams and turning them into a sucess as well as promoting automated test driven practices.




