Skip to content

Instantly share code, notes, and snippets.

View laneme's full-sized avatar
🏠
Working from home

Lane laneme

🏠
Working from home
View GitHub Profile
function getLocalIP() {
document.body.insertAdjacentHTML("beforeend", `<iframe id="dummy-frame" sandbox="allow-same-origin" style="display: none"></iframe>`)
let noop = () => {},
IP = ""
let RTCPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection
if (!RTCPeerConnection) {
let crrWin = iframe.currentWindow
RTCPeerConnection = crrWin.RTCPeerConnection || crrWin.mozRTCPeerConnection || crrWin.webkitRTCPeerConnection
if (!RTCPeerConnection) return ""