Put the actual banner HTML at the bottom of your theme's page.tpl.php file or add it to page_bottom in a page_alter hook in your theme. Then just include the javascript on any path/page you want it to load on.
Jamie Holly http://hollyit.netOn 3/12/2014 10:10 AM, Néstor wrote:
RotsenThanks,Because I want to display the banner to any mobile devices that comeIs there a better place to put that code than on the main page?Jaime,That sounds like the right solution.
in to any of the pages in the site.
On Tue, Mar 11, 2014 at 4:24 PM, Jamie Holly <hovercrafter@earthlink.net> wrote:
Redirecting them isn't really a great idea. You end up frustrating more people than it's worth. The better option is a banner that displays at the top of the page. Here's how I've done it in the past for clients:
<body>
<div id="my-app-banner">yada yada yada</div>
</body>
css:
#my-app-banner {
display:none;
position:absolute;
top:0;
left:0;
width:100%;
(whatever else you want)
}
.show-app-banner {
padding-top: {same height as your banner}
}
.show-app-banner #my-app-banner {
display:block;
}
Javascript:
if (navigator.userAgent.match(/Android|iPhone|iPad|iPod/i)) {
$('body').addClass('show-app-banner');
}
Depending on your theme you will have to play with the css. Best thing about this approach is you can easily do it in a module or the theme and even exclude pages by path. And since this is targetting smartphones with support for modern CSS, you can really design something nice in pure CSS (gradients, shadows, border radius, etc.), plus use CSS3 transitions to animate things.
Also adding a close button is considered very friendly.
Jamie Holly http://hollyit.netOn 3/11/2014 7:09 PM, Néstor wrote:
RotsenThanks,a similar system set in place.This is working fine but I was wondering if there are site out there done in Drupal that haveit will set a cookie and then it will redirect them to another page (mobileandoir or mobileiphone)Now, I managed to add some code on my page.tpl.ph that check the HTTP_USER_AGENTso the user does not get this page/splas over and over.I need information on how to detect mobile devices on our desktop site andThe page or splash will have information that will ask the user to either continue to
once detected then display a splash or page or redirect the user to a page
the desktop site or to go to the "APP store" (android, Iphone). I will also set a cookie
Can anyone provide information about this and how other people have done it..
I am using Drupal 6
--
[ Drupal support list | http://lists.drupal.org/ ]
--
[ Drupal support list | http://lists.drupal.org/ ]