Discussion Forums  >  Uncategorized

Replies: 7    Views: 369

Going-Viral
Apple Fan
Profile
Posts: 120
Reg: Jun 13, 2011
Doncaster
1,200
10/06/11 04:59 AM (14 years ago)

AlertView to Promote iPhone App

I have made an iPhone App for my new website, but would like to inform users who visit my website with an iPhone to be informed there is an App avilable with a link to either Cancel (stay in browser) or if they choose Ok, it redirects them to the App on the App Store. I've see this done on the www.dailymail.co.uk website, any ideas as to how this is actually achieved? Many thanks in advance as always :-)
 
MacApple
Apple Fan
Profile
Posts: 4675
Reg: Oct 25, 2010
USA
61,150
like
10/06/11 05:10 AM (14 years ago)
Morning. Can't provide code I'm afraid but you can add some JavaScript to your site to detect device being used then get it to 'do something' as it were. Have a look here for a starter - http://iphone.wikidot.com/detection
 
Going-Viral
Apple Fan
Profile
Posts: 120
Reg: Jun 13, 2011
Doncaster
1,200
like
10/06/11 06:33 AM (14 years ago)
Many thanks, but I've sussed it, the following code needs to be placed in between the <head> </head> tags of your HTML: <script type=text/javascript> function iPhoneAlert() { if ( navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPod/i) ) { var iMessage = confirm( We have developed a FREE iPhone App, would you like to download it? ); if ( iMessage ) window.location = Insert App Store link here; } } </script> And then modify the body tag as follows: <body onload=iPhoneAlert();> I hope this proves helpful :-)
 
Aaron636r
Aspiring developer
Profile
Posts: 246
Reg: Mar 08, 2011
California
3,160
like
10/06/11 09:12 AM (14 years ago)
Good info. Thanks for sharing
 
Aaron636r
Aspiring developer
Profile
Posts: 246
Reg: Mar 08, 2011
California
3,160
like
10/06/11 09:13 AM (14 years ago)
Wonder if the same works for Android?
 
aussiedra
Code is Art
Profile
Posts: 431
Reg: Dec 25, 2010
Brisbane, Austr...
8,260
like
10/07/11 01:52 AM (14 years ago)
else if ( navigator.userAgent.match(/Android/i) ) { var qes = confirm( We have developed a free Android App, would you like to download it?. ); if ( qes ) window.location = Insert App Store link here; } } </script>
 
Going-Viral
Apple Fan
Profile
Posts: 120
Reg: Jun 13, 2011
Doncaster
1,200
like
10/07/11 02:47 AM (14 years ago)
Glad I could give something back to the BuzzTouch Community, it was driving me nuts, but got there in the end :-)
 
MacApple
Apple Fan
Profile
Posts: 4675
Reg: Oct 25, 2010
USA
61,150
like
10/07/11 04:39 AM (14 years ago)
Nice one gents, good stuff.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.