javascript - Prevent Smart app banner from showing on iPad -
i have website shows smart app banner on ios using html meta tag. want banner show on iphones & ipods.
how can prevent showing on ipads?
the code i'm using (from apple resource):
<meta name="apple-itunes-app" content="app-id=myappstoreid">
you'll have using javascript, since there no proper way platform detection solely in html.
get rid of meta tag in html code , use following snippet, or use parts of it, like. if want use 'as-is', paste @ bottom of body.
(function($){ var is_ipad = navigator.useragent.match(/ipad/i) != null; // fill in apple-app stuff here var app_id = "<your_apple_app_id>", affiliate_data = null, app_argument = null; // exclude ipad if(!is_ipad) { var meta = $("<meta>"), content = 'app-id=' + app_id; meta.attr('name', 'apple-itunes-app'); // optional stuff (only when filled in) if(affiliate_data) content += ', affiliate-data=' + affiliate_data; if(app_argument) content += ', app-argument=' + app_argument; // apply meta.attr('content', content); $('head').append(meta); } }(jquery));
Comments
Post a Comment