Get your private-ip using WebRTC
$ npm install webrtc-private-ip
Or using a CDN:
<script src="https://unpkg.com/@shaharmor/webrtc-private-ip"></script>
(async () => {
const ip = await webrtcPrivateIp();
if (ip) {
//ip => '192.168.1.1'
}
})()
- Will only works when WebRTC mDNS is not enabled.