Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js if on cellular network

let preloadVideo = true;
var connection = navigator.connection || navigator.mozConnection || navigator.webkitConnection;
if (connection) {
  if (connection.effectiveType === 'cellular') {
    preloadVideo = false;
  }
}
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #js #cellular #network
ADD COMMENT
Topic
Name
1+1 =