답변

0

일부 네트워크는 http 헤더로 연결 유형을 보냅니다.

가장 좋은 방법은 사용자가 연결할 때 속도 테스트를하고 그에 대한 JS 개체있다 2.2 안드로이드에서 쿠키

3

으로 클라이언트에 저장하려고하는 것입니다.

연결 유형에 따라 CSS 사용을위한 클래스를 작성할 수 있습니다. 하지만 모바일 웹 사이트의 경우 iOS에서는 사용할 수 없습니다.

var connection, connectionSpeed, htmlNode, htmlClass; 
connection = navigator.connection || {"type":"0"}; // fallback 

switch(connection.type) { 
    case connection.CELL_3G: connectionSpeed = "mediumbandwidth"; break; 
    case connection.CELL_2G: connectionSpeed = "lowbandwidth"; break; 
    default: connectionSpeed = 'highbandwidth'; 
} 

/* set the connection speed on the html element 
    i.e. <html class="lowbandwidth"> 
*/ 
htmlNode = document.body.parentNode; 
htmlClass = htmlNode.getAttribute("class") || ""; 
htmlNode.setAttribute("class", htmlClass + " " + connectionSpeed); 

코드는 이러한 프레젠테이션의 슬라이드 (24)로부터이다
http://davidbcalhoun.com/present/mobile-performance/

관련 문제