Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

network information api js

navigator.connection.addEventListener('change', logNetworkInfo);

function logNetworkInfo() {
    // Network type that browser uses
    console.log('type: ' + navigator.connection.type);
    // Effective bandwidth estimate
    console.log('downlink: ' + navigator.connection.downlink + ' Mb/s');
    // Effective round-trip time estimate
    console.log('rtt: ' + navigator.connection.rtt + ' ms');
    // Upper bound on the downlink speed of the first network hop
    console.log('downlinkMax: ' + navigator.connection.downlinkMax + ' Mb/s');
    // Effective connection type determined using a combination of recently
    // observed rtt and downlink values: ' +
    console.log('effectiveType: ' + navigator.connection.effectiveType);
    // True if the user has requested a reduced data usage mode from the user
    // agent.
    console.log('saveData: ' + navigator.connection.saveData);
    // Add whitespace for readability
    console.log('');
}

logNetworkInfo();
Comment

PREVIOUS NEXT
Code Example
Javascript :: add grepper code 
Javascript :: Cache and return requests 
Javascript :: angular detect navigation change 
Javascript :: PASSWORD REDIRECT 
Javascript :: index javascript array 
Javascript :: how to get current row value by clicking a button 
Javascript :: javasript vetical menu cog 
Javascript :: Domafter injection bottom 
Javascript :: firebase messaging service not working with electron 
Javascript :: escape exponential input number in js 
Javascript :: how to get min value from array of objects in javascript 
Javascript :: using fetch hook 
Javascript :: key html 
Javascript :: shopify hover effect 
Javascript :: javascript filtrar array string 
Javascript :: downlaod file from website raect2 
Javascript :: custu, loading next js 
Javascript :: pass values and functions from a Child component to a Parent using a ref 
Javascript :: “javascript sleep 1 second” is a pretty common code problem that people search ;-) 
Javascript :: jquery datatable dropdown from stored procedure values 
Javascript :: useHistory: useNavigate if you install v6 or more than react-router-dom": ^6.2.1 
Javascript :: typeorm class validator 
Javascript :: Changing Async/Await to Promises.all to Speed Up API Calls in Node.JS 
Javascript :: how to add heaeader to http angular client 
Javascript :: JavaScript URL Parse including pathname 
Javascript :: show route between markers google maps javascript 
Javascript :: cypress contains regex 
Javascript :: mm2javascript 
Javascript :: root emit with params 
Javascript :: Javascripttrepeat 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =