I have an application locally and since I do not have a domain I need to know the server IP from javascript, my application shares files by link and the link starts with link
I need to know the local server ip using javascript
Check out this page
$.getJSON('//freegeoip.net/json/?callback=?', function(info) {
console.log(info);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
From this page you can consult directions
I do not know what you're doing, but it does not sound like a good idea to want to capture the IP to go and rescue something from the server. You should continue to use the domain name you intend to use. In case you do not have a domain yet, you could force your operating system to resolve the domain you need.
For that you have to edit the hosts file. There you must add the name of the domain and the IP that resolves:
192.168.0.1 mydomain.com
In linux it is in / etc / hosts and in windows C: \ Windows \ System32 \ drivers \ etc \ For both cases you need permission from roott / administrator respectively. Keep in mind that this solution will only work on YOUR computer. If you want to share the change with someone else in your network, you must tell them to make the same configuration as you.