i am doing mobile version for my website .what i am doing here is when page is loaded , in my home.html(desktop version) i am writing javascript here,i am detecting with mobile names but what i need is i want to detect to check with the width of mobile device(e.g.,800px) rather with mobile names.how to do?
var ua = navigator.userAgent;
if ((ua.match(/iPhone/i)) || (ua.match(/Android/i))) {
location.replace("mhome.html");
}
Jaganathan BantheswaranPosted Oct 18, 2013, 10:11 AM
Its better to user @media queries.
media="only screen and (max-device-width: 480px)" href="small-device.css" />
the above link will be added only if the device width is 480px [smart phones].
Refer this link for more details