Hi Guys. Currently, Invsion Community displays the code for mobile devices using @media screen, which is ok, but it only seemingly hides the code because it is still in the source.
Being on the desktop, the code for mobile devices is unnecessarily loaded.
Why not use PHP for mobile device detection? This code is just an example, but it shows that it can be done in a simple way.
<?php
//-- Very simple way
$useragent = $_SERVER['HTTP_USER_AGENT'];
$iPod = stripos($useragent, "iPod");
$iPad = stripos($useragent, "iPad");
$iPhone = stripos($useragent, "iPhone");
$Android = stripos($useragent, "Android");
$iOS = stripos($useragent, "iOS");
//-- You can add billion devices
$DEVICE = ($iPod||$iPad||$iPhone||$Android||$iOS);
if (!$DEVICE) { ?>
<!-- What you want for all non-mobile devices. Anything with all HTML, PHP, CSS, even full page codes-->
<?php }else{ ?>
<!-- What you want for all mobile devices. Anything with all HTML, PHP, CSS, even full page codes -->
<?php } ?>
This would bring many benefits because being on a mobile device (or on a desktop), we would only load the code that is needed, excluding the one that is unnecessary. This would reduce the weight of the html file and improve the speed.