I want to detect if the user that visit my website is using mobile or pc, if he is using pc the code should load special css and html code, else the code should load different css and html code(both html and css for both devices IN THE SAME FILE).
For detecting the device, I checked many codes but unfortunately they all provide that only for special mobiles(iphone, ipad, android, blackberry, galaxy...), I want a code that works for whole mobiles.
Example of device detection:
function DetectIphone()
{
var uagent = navigator.userAgent.toLowerCase();
if (uagent.search("iphone") > -1)
alert('false');
else
alert('true');
}
The problem in this code that it works only for iphone.