Account
 
 
 
0
 
 
21 Jun

Free: Mobile Detection Pluginzur Erkennung von mobilen Geräten in Joomla!

Heute haben wir wieder ein kostenloses Free Joomla! Plugin für alle Joomla-Anwender (Joomla! 2.5, 3.x und höher) im Gepäck - es hört auf den selbsterklärenden Namen "yagendoo Joomla! Mobile Detection".

Das Plugin ist wirklich simpel aufgebaut und hilft Anwendern und Entwicklern in ihrem Code abzufragen, ob das Gerät mit dem die Webseite gerade besucht wird, ein mobiles Gerät, wie ein Handy oder ein Tablet-PC ist oder nicht.

Zudem können viele weitere Informationen wie das Betriebssystem, der Useragent oder der genaue Typ des mobilen Geräts abgefragt und oder genutzt werden.

Insbesondere auch beim Thema "Responsive Webdesign" kann man mit dem "yagendoo Joomla! Mobile Detection" wirklich cooles Zeug anstellen - der geneigte Anwender und Entwickler weiß Bescheid und wird es zu nutzen wissen. ;-)

Zwar gibt es in Joomla! bereits eine Funktion, die eigentlich genau dies tun soll, allerdings tut Joomla! selbst -aufgrund der Komplexität des Themas- dies nicht zuverlässig genug, was natürlich fast in der Natur der Sache liegt, da die Anzahl an unterschiedlichen mobilen Geräten und deren Betriebssysteme rasant wächst.

Download

Hier könnt ihr euch die jeweils aktuellste Version des Plugins herunterladen.

Plugin herunterladen  

Lizenz

Das Plugin ist kostenlos für Privatpersonen oder Unternehmen verfügbar und ist unter der GNU/GPLv3 veröffentlicht. Ihr dürft das Plugin für eure eigenen Seiten nutzen, es auf anderen Webseiten verwenden oder ein eigenes Plugin darauf basierend erstellen und es weiter verbreiten. Alle Copyrights im Code müssen erhalten bleiben.

Verfügbare Funktionen

Folgende Funktionen stehen im "yagendoo Joomla! Mobile Detection" zu Verfügung.

MobileDetector::isMobile();

MobileDetector::getUserAgent();

MobileDetector::getPhoneDevices();

MobileDetector::getTabletDevices();

MobileDetector::isTablet($userAgent = null, $httpHeaders = null);

MobileDetector::is($key, $userAgent = null, $httpHeaders = null);

MobileDetector::getOperatingSystems();

Credits

Das Plugin basiert auf der ebenfalls frei erhältlichen (MIT) Code-Libary von Șerban Ghiță, die das eigentliche Herz des Plugin bildet. Danke für deine tolle Arbeit Șerban!

Und euch viel Spaß mit dem Plugin. Wenn euch das Plugin gefällt, könnt ihr hier den Ursprünglichen Entwickler hier unterstützen.

Veröffentlicht von YannickS am in News
Bewerte diesen Beitrag:
10
34 Kommentare  
 
 

Kommentare

  • Robert Went Dienstag, 25 Juni 2013

    Great stuff :)

    I was about to build this into my template but I guess now there is no need.
    Are there any limitations on usage? Ie. can I use it in the main index file of a template and in any override?

    Thanks for your work on this!

     
  • YannickS Mittwoch, 03 Juli 2013

    Hey Robert,

    there is no limitation. You can use it wherever you need it!

    Kind regards,
    Yannick

     
  • Robert Went Mittwoch, 03 Juli 2013 1 Person gefällt dieser Kommentar.

    Perfect! I think I might build a few options for it into my new template:)

     
  • nick Donnerstag, 29 August 2013

    I've got the plugin installed and working, but am having trouble understanding how to use the MobileDetector::isMobile(); function.

    For example, I want to detect if it's a mobile/tablet device and redirect to a sub-domain.

    Could you provide any examples of using the functions?

    Thanks!

     
  • SimonS Montag, 02 September 2013

    Hello Nick,

    the "isMobile" methods returns true if a mobile device is detected, so in your case an example code would look like:
    if(MobileDetector::isMobile() === true)
    {
    // mobile device detected do redirect
    header('Location: http://some.subdomain.com', true, 301);
    exit;
    }

     
  • Ian Wensink Montag, 09 September 2013

    Hello,

    This plugin looks like the one I need, but I really have no idea of how to use it. I clicked 'download plug-in' which gave me a zip with a php script. What should I do now? Where do I have to put the file or the code? And can you explain step by step how to use the plugin? So what do I have to do so the visiter gets to an other page like the question above. I'm not very expert in php, so if you could explain everything it would be very handy.

    Thanks in advantage,
    Ian Wensink

     
  • YannickS Montag, 09 September 2013

    Hello Ian,

    just install it via the Joomla installer. But if you want use it, it´s required to have some PHP-skills. It´s mainly developed for other developers.

    Currently we can´t provide a step-by-step guide, because of lack of time. I am sorry!!

    Kind regards,
    Yannick

     
  • Sammy Donnerstag, 17 Oktober 2013

    Hi Yannick,

    I want once it detects mobile device, to redirect to a sub domain. I've read the comments here and I have one question.

    Where do I place this code?

    if(MobileDetector::isMobile() === true)
    {
    // mobile device detected do redirect
    header('Location: http://some.subdomain.com', true, 301);
    exit;
    }

    On the root index page or on the template index page?

    Kind regards,

    Sammy

     
  • YannickS Donnerstag, 17 Oktober 2013

    Hey Sammy,

    if you place it in the root index file, it is a hack what maybe will overrided by a Joomla update. I think you should put it in your template index, if you only use one template.

    Best regards,
    Yannick

     
  • Boldee Mittwoch, 23 Oktober 2013

    I originally used the php mobile detect code directly in my index.php this plugin is a real time saver thank-you for that.

    I have a question however, is there a way to override mobile detection so that users have an option to view the desktop version of the site from the mobile device via a redirect?

     
  • YannickS Freitag, 25 Oktober 2013

    Hello Boldee,

    currently not - I am sorry, but we work on something like that. Sorry to say, that I can´t give you a timeframe for now.

    Kind regards
    Yannick

     
  • Boldee Freitag, 25 Oktober 2013

    Hi YannickS
    Thanks for the reply.

    If you can get a function working in the future for redirection that would a be great asset for this plugin.

    I did a little research after posting here about whether my website users actually want to be forced to use a mobile site or have a choice of desktop or mobile and it was a split 50 50, so I have decided to take a different approach, I am however still using this great plugin all be it slightly different to how I originally intended :)

     
  • Rob Freitag, 25 Oktober 2013

    I think you would have to set a cookie and then check for it before redirecting.

    Then you can direct to the mobile if nothing is set and if they choose desktop set a cookie which would be picked up the next time the page is loaded and then not redirect.

     
  • F Montag, 17 März 2014

    Hello Rob,

    I find your advice helpfull. I'm trying different approaches on preventing further redirection with cookies the whole day and non of them worked. I get always redirected. Could you please provide an example?

    Here is what I'm trying in Joomla:

    if(MobileDetector::isMobile() === true && isset($_COOKIE['mobile']))
    {
    // problem is here:
    MobileDetector::isMobile() === false;
    // tried even: return false; | $detect = "false";
    // none working
    }
    elseif(MobileDetector::isMobile() === true)
    {
    header('Location: http://m.site.com', true, 301);
    exit;
    }

    And in the mobile site:

    setcookie("mobile","m", time()+3600, "/");

    //----------------------------------------------

    I followed this example (http://stackoverflow.com/questions/5844966/view-full-site-mobile-site-option) as well, but it won't work directly with the yagendoo Joomla plugin:

    isMobile() && isset($_COOKIE['mobile']))
    {
    $detect = "false";
    }
    elseif ($detect->isMobile())
    {
    header("Location:http://www.yourmobiledirectory.com");
    }
    ?>

    Thank you!

     
  • Nick N Montag, 30 Dezember 2013

    Neither one of these actually works. I have a Galaxy S4 and neither one shows information when echoing these below. User agent works and detecting if mobile works but not these.

    MobileDetector::getPhoneDevices();

    MobileDetector::getTabletDevices();

     
  • Dragma Sonntag, 09 März 2014

    Hi! thanks for this incredibly useful plugin. I have a problem, I wonder if you can help.
    I did an if/else to hide a particular module when loading on mobile devices, but it still loads it. Here is the code simplified:
    countModules('login')) : ?>













    Thank you,

     
  • Michael Montag, 10 März 2014

    First of all, thank you for this handy plugin!

    When i activate Joomla cache, it doesn't work as expected, though. I use the plugin in order do distinguish between desktop and mobile navigation. When i browse the site simultaneously on a desktop and a mobile browser i often get the wrong site elements with cache turned on.

    Did anybody encounter the same problems yet and is there a solution?

    Thanks

     
  • Michael Donnerstag, 13 März 2014

    FYI: we managed to bypass the problem by using a thirdparty cache extension.

     
  • Filip Mittwoch, 19 März 2014

    Hello,
    Can anyone provide an example of "View full site" redirection with cookie?
    I try to avoid loop redirections to the site's mobile version.
    I tried something like this, but it always ends with loading the mobile site:
    if(MobileDetector::isMobile() === true && isset($_COOKIE['mobile']))
    {
    return false;
    } else {
    header('Location: http://m.site.com', true, 301);
    exit;
    }

    ... and on the mobile landing page:
    setcookie("mobile","m", time()+3600, "/");

    Thanks!

     
  • Guest! Sonntag, 13 April 2014 1 Person gefällt dieser Kommentar.

    404 not found on download link!

     
  • YannickS Dienstag, 15 April 2014

    Thanks for the information - download link is fixed!

     
  • Nik Dienstag, 19 August 2014

    Hi!!

    The plugin works perfect! But I want to know if there is a way to check if the user is on an iPhone?
    Maybe something like this?: $phone = MobileDetector::getPhoneDevices();
    if($phone == "iPhone")
    do something...

     
  • Jonathan Roza Montag, 20 Oktober 2014

    Hi.

    First, I would like to tell that it seems to be a very promising plugin (didn't use it yet).
    My question is: Can I "load a module if it is mobile", or "not load a module if it is mobile"?

    Like:
    MobileDetector::isMobile();
    or
    MobileDetector::isNOTMobile();

    (forgive me the IsNOTMobile, but I don't know the proper command to detect a "not mobile browser". Maybe it's something like !isMobile?).

    Thank's!

     
  • Guy Montag, 27 Oktober 2014

    I need some help! I'm trying to use this plugin in Joomla-virtuemart on a default_products.php page that gets displayed in an html template, without success.

    I originally tried Serbanghita's plugin without luck and them tried this Joomla plugin.

    I'm assuming I don't need to call the plugin up on any page, once it's installed and actiavted?

    I'm trying to use the output to create a conditional callup - and it's not working:

    // Show Products ?>
    isMobile() && !$detect->isTablet() ) { ?>





    The end result is, whatever appears above that conditional segment appears live but without any formatting, and whatever should appear from that conditional segment onwards doesn't get displayed at all. What am I doing wrong?

     
  • TobiasR Montag, 27 Oktober 2014

    Hi,

    once the plugin is installed you should be able to call it using this code:

    if(MobileDetector::isMobile() === true)
    {
    // do something
    }

    Kind regards,
    Tobias

     
  • IanE Mittwoch, 18 März 2015

    I thought I had this working perfectly but it detects Chrome on a desktop as mobile, all other browsers I've tried (desktop and Android) work ok, any thoughts as to why this should be? I've tried on a completely different machine and it's exactly the same, use Chrome (Version 41.0.2272.89 m) from a desktop and the plugin thinks I'm mobile.

    Thanks,

    Ian

     
  • IanE Mittwoch, 18 März 2015

    Ignore my earlier post regarding Chrome (unless you've come here with the same problem) I downloaded the plugin again and it's working fine now so I guess there must have been an update.

    Thanks for a really useful solution.

    Ian

     
  • Alex Mittwoch, 08 April 2015

    Hi, how do I script the code to see if a device is using the android stock browser?

     
  • Alex Mittwoch, 08 April 2015

    Hi, how do I script a query to see if the browser is the Android stock browser?

     
  • Alex Samstag, 11 April 2015

    Hi, how do I write the query to detect if a browser is the Android Stock browser?

     
  • Alex Montag, 13 April 2015

    ...is there also a way of identifying the Chrome browser on Android devices?

     
  • Ross Freitag, 11 September 2015

    Hi there!
    How can I find if visitor is using the tablet? Because there is no function or method "MobileDetector::isTablet();". And how can I find what OS is using by visitor? I need to know if it's iOS. Can You show some examples or link to documentation? Thank You!

     
  • stuart Mittwoch, 21 Oktober 2015

    how can hidde modules?

     
  • Madhvee Dienstag, 05 Januar 2016

    With reference to the following post:

    Michael Thursday, 13 March 2014
    FYI: we managed to bypass the problem by using a thirdparty cache extension.

    Can you please provide more details?
    I have same issue - plugin does not work when cache is on.

    Madhvee

     

Gast  Sonntag, 25 September 2016

 

Sie brauchen technische Unterstützung?

Wir helfen bei Problemen und erstellen ganze Webseiten und Onlineshops für Sie!

Yagendoo Media Team

Jetzt Anfragen.

» Referenzen «