MeiKatz / local-domain-checker

Check if the domain your script is running on belongs to a local machine

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Local Domain Checker

Check if the domain your script is running on belongs to a local machine

How to use

first load script into your file ...

<script src="local-domain-checker.js"></script>

... and than call the function

// without an argument
window.isLocal(); // returns either true or false
// with an argument
window.isLocal("localhost"); // true
window.isLocal("127.0.0.1"); // true
window.isLocal("::1"); // true
window.isLocal("foobar.local"); // true
window.isLocal("foobar.localhost"); // true
window.isLocal("foobar.test"); // true

window.isLocal("example.org"); // false
window.isLocal("142.42.42.42"); // false

About

Check if the domain your script is running on belongs to a local machine


Languages

Language:JavaScript 100.0%