Excluir outras referencias para mobile dentro da pasta de js, css, html, etc.
Atencao para o opera-mobile: Nos testes, o opera mobile emulator (rodando no windows) nao foi reconhecido como mobile
1.a) Javascript Simples
if( navigator.userAgent.match(/Android/i)
|| navigator.userAgent.match(/webOS/i)
|| navigator.userAgent.match(/iPhone/i)
|| navigator.userAgent.match(/iPad/i)
|| navigator.userAgent.match(/iPod/i)
|| navigator.userAgent.match(/BlackBerry/i)
|| navigator.userAgent.match(/Windows Phone/i)
|| navigator.userAgent.match(/ZuneWP7/i)
){
// some code..
}
-------------------------------------------------
1.b) JavaScript Simples
function is_mobile() {
var agents = ['android', 'webos', 'iphone', 'ipad', 'blackberry', 'Windows Phone', 'ZuneWP7'];
for(i in agents) {
if(navigator.userAgent.match('/'+agents[i]+'/i')) {
return true;
}
}
return false;
}
1.b.etc) Outra opcao
if( navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/BlackBerry/i) ){
//Action
}
-------------------------------------------------
2) JavaScript incorporado
// Web Site: http://www.mobileesp.com
// Source Files: http://code.google.com/p/mobileesp/
// http://code.google.com/p/mobileesp/source/browse/
// http://code.google.com/p/mobileesp/source/browse/JavaScript/mdetect.js
-------------------------------------------------
3) JQuery simples
/*** sniff the UA of the client and show hidden div's for that device ***/
var customizeForDevice = function(){
var ua = navigator.userAgent;
var checker = {
iphone: ua.match(/(iPhone|iPod|iPad)/),
blackberry: ua.match(/BlackBerry/),
android: ua.match(/Android/)
};
if (checker.android){
$('.android-only').show();
}
else if (checker.iphone){
$('.idevice-only').show();
}
else if (checker.blackberry){
$('.berry-only').show();
}
else {
$('.unknown-device').show();
}
}
-------------------------------------------------
4) CSS at-rule
@media all and (max-width: 600px) { /* Largura do #screen */
#elemento {}
}