Plunder 0 Denunciar post Postado Maio 8, 2014 Boa noite, Coloquei um redirecionamento em PHP para dispositivos móveis. Do jeito que estava funcionou, mas depois que mudei... ASSIM foi como peguei. No Desktop fica normal e no celular/tablet vai para o sub domínio. <?php if ($_GET["op"] != "nomobile") { echo(' <script type="text/javascript"> //<![CDATA[ if (screen.width <= 960) { window.location.replace("http://m.site.com.br") } //]]> </script> '); } ?> ENTÃO mudei assim e no tablet acessava M1 e no celular acessava M2. Mas quando fui no desktop direcionou para M1 por conta do >= 800. <?php if ($_GET["op"] != "nomobile") { echo(' <script type="text/javascript"> //<![CDATA[ if (screen.width >= 800) { window.location.replace("http://m1.site.com.br") } if (screen.width <= 600) { window.location.replace("http://m2.site.com.br") } //]]> </script> '); } ?> Pesquisei um monte de coisa no Google mas nada funcionou. Eu queria o seguinte: se a resolução for menor ou igual a 600 então carrega M2 e entre 601 e 800 carregue M1. No caso o que for maior que 800 deve carregar no desktop. Desde já agradeço a quem puder me ajudar. att, Marcos Paulo. Compartilhar este post Link para o post Compartilhar em outros sites
lokaodomau 61 Denunciar post Postado Maio 8, 2014 if (screen.width >= 800){ // direcionamento para desktop } else if (screen.width <= 600) { window.location.replace("http://m2.site.com.br") } else if (screen.width > 600 && screen.width < 800) { window.location.replace("http://m1.site.com.br") } Seria isso? (JavaScript) Compartilhar este post Link para o post Compartilhar em outros sites
Kakashi_Hatake 267 Denunciar post Postado Maio 9, 2014 Para detectar se é um dispositivo móvel use http://detectmobilebrowsers.com/ Compartilhar este post Link para o post Compartilhar em outros sites
Plunder 0 Denunciar post Postado Maio 10, 2014 Bom dia, LOKAODOMAU - OBRIGADO PELA RESPOSTA, FUNCIONOU PERFEITAMENTE CARLOS COELHO - OBRIGADO PELA RESPOSTA, OS CÓDIGOS VÃO AJUDAR MUITO Compartilhar este post Link para o post Compartilhar em outros sites