Skip to content
This repository was archived by the owner on Aug 29, 2022. It is now read-only.

cornips/getLocalIP

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DEPRECATED

This code doesn't work anymore and I'm not planning on updating it.

Introduction

To identify clients in internal web systems it is sometimes useful to know its local IP address. With this little JS (only 847 bytes gzipped), borrowed from Daniel Roesler, you can do this.

Installation

npm install getlocalipjs

Usage

Just make sure you have the following code in your HTML at the bottom:

<!-- hidden iframe to bypass webrtc blocking -->
<iframe id="iframe" sandbox="allow-same-origin" style="display:none"></iframe>
<script src="dist/getlocalip.min.js"></script>
<script>
    getLocalIP(function(ip){
        console.log(ip);
    });
</script>

About

⛔️ DEPRECATED Little JS to get local IP address

Topics

Resources

License

Stars

Watchers

Forks

Languages

  • JavaScript 83.0%
  • HTML 17.0%