I already know this excellent answer Detecting a mobile browser and detectmobilebrowsers.com.
But each time you want to use it, you have to:
- download http://detectmobilebrowsers.com/download/javascript to get the latest updated version
- modify it to create a function
isMobile()
that would returntrue
orfalse
, available anywhere in your code (no such ready-to-use function is available out-of-the-box with detectmobilebrowsers.com I think?) - modify it to take this comment in consideration
- etc.
Of course I could do it once for all, but then it wouldn't be updated often, etc.
Question: is there a CDN version of such a mobile detection snippet (detectmobilebrowsers.js or another), with high efficiency and long time support, that would allow me to just do:
<script src="https://cdnjs.cloudflare.com/detectmobilebrowsers.js?tablets=include"></script>
<script>
if (isMobile()) { ... }
</script>