# Network Information API 📡
📗
The Network Information API provides information about the system's connection in terms of general connection type. This can be used to select high definition content or low definition content based on the user's connection.
🛑
This is an experimental technology. Check the Browser compatibility table carefully before using this in production.
# Examples
# Demo #1
Network demo with listeners
Network Status:
- connectionType:
- connectionMode:
Code
const connection = navigator.connection || navigator.mozConnection || navigator.webkitConnection
let connectionType = connection.effectiveType
function updateConnectionStatus() {
console.log(`Connection type changed from ${connectionType} to ${connection.effectiveType}`)
connectionType = connection.effectiveType
}
connection.addEventListener('change', updateConnectionStatus)
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9