浏览器获取用户内网IP

var uip= '';

getIPs(addIP);  //调用获取IP函数,传入回调函数

function addIP(ip) {

    uip = ip;

}

function getIPs(callback) {

    var ip_dups = {};

    //compatibility for firefox and chrome

    var RTCPeerConnection = window.RTCPeerConnection ||

            window.mozRTCPeerConnection ||

            window.webkitRTCPeerConnection;

    var useWebKit = !!window.webkitRTCPeerConnection;

    //bypass naive webrtc blocking using an iframe

    if (!RTCPeerConnection) {

        //NOTE: you need to have an iframe in the page right above the script tag

        //

        //

        //

你可能感兴趣的:(浏览器获取用户内网IP)