adamdehaven
adamdehaven

Reputation: 5920

Will iOS 6 Smart Banner for Phone app show on website if viewed on iPad?

I just released an iPhone app today. I have also implemented Apple's Smart Banners on my website.

If the app is ONLY an iPhone app (although it will run at 2x on an iPad, but is NOT a Universal app), should the Smart Banner be showing when the webpage is viewed on an iPad?

According to the docs (link above) the Smart Banner will determine if it should be displayed on the device. Apple Smart Banner detects device and determines if banner should be displayed

Question: Should the banner be displaying for an iPhone app only when viewing the webpage on an iPad?

Upvotes: 3

Views: 3162

Answers (2)

micho
micho

Reputation: 2226

If you want to show the smart banner detecting iPhone vs iPad, insert the following code just before the tag:

<script>
if (navigator.userAgent.match(/iPad/i)) {
  $('head').append("<meta name='apple-itunes-app' content='app-id=XXYYZZ, app-argument=ios-promo'>");
} else if (navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPod/i)) {
  $('head').append("<meta name='apple-itunes-app' content='app-id=PPQQRR, app-argument=ios-promo'>");
}
</script>

Since the script is executed before closing the tag, it will be executed as part of the page load and iOS 6 will recognize it.

Upvotes: 7

KPM
KPM

Reputation: 10608

I don't exactly get your question. If you mean 'will the Banner show up on an iPad?', then the answer is yes, the Banner for an iPhone-only (not Universal) app shows up on an iPad (if you meant 'should Apple change this behaviour?', then this is a subjective question).

Upvotes: 2

Related Questions