웹브라우저로 현재 접속하고 있는 사용자의 내부IP, Local IP (192.168.*.*)을 알아내는 방법이 있나요?

1 답변

0 투표

function checkLocal() {

                window.RTCPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection;   //compatibility for firefox and chrome

                var pc = new RTCPeerConnection({iceServers: []}), noop = function () {

                };

                pc.createDataChannel("");    //create a bogus data channel

                pc.createOffer(pc.setLocalDescription.bind(pc), noop);    // create offer and set local description

                pc.onicecandidate = function (ice) {  //listen for candidate events

                    if (!ice || !ice.candidate || !ice.candidate.candidate) return;

                    var myIP = /([0-9]{1,3}(\.[0-9]{1,3}){3}|[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7})/.exec(ice.candidate.candidate)[1];

                    jQuery(document).ready(function () {

                        console.log(myIP);

                    });

                    pc.onicecandidate = noop;

                };

            }

getLocal();

구로역 맛집 시흥동 맛집
이 포스팅은 쿠팡 파트너스 활동의 일환으로, 이에 따른 일정액의 수수료를 제공받습니다.
add
...