function CheckMobile() { var protocol = location.protocol; var hostname = location.hostname; var url_file_name = "" + location.href.split("/").slice(-1); var screen_width; var screen_height; screen_width = screen.width; screen_height = screen.height; //screen_width = window.innerWidth; //screen_height = window.innerHeight; if(screen_width < screen_height) // Dispositivo mobile { if(url_file_name.indexOf("m-") == -1 || url_file_name.indexOf("m-") > 0) // In pagina non mobile { var m_url = protocol + "//" + hostname + "/ScuolaParacadutismoFerrara/m-" + url_file_name; document.location = m_url; //**** //alert("Metti il dispositivo in orizzontale!"); //**** } } else // Dispositivo desktop { if(url_file_name.indexOf("m-") == 0) // In pagina mobile { url_file_name = url_file_name.substring(2, url_file_name.length); url_file_name = url_file_name.replace(".jsp", ".htm"); var d_url = protocol + "//" + hostname + "/ScuolaParacadutismoFerrara/" + url_file_name; document.location = d_url; } } } // window.onresize = function(event) { //CheckMobile(); }; //CheckMobile();