IP address recognition
Moderator: Neosoft Support
- HackinHoodLogicsTm
- Posts: 131
- Joined: Wed Aug 28, 2013 7:03 am
- Location: Ghana
- Contact:
IP address recognition
Hi NAB,
Please is it possible to retrieve the IP address from your network and store it in a text field?
Please, any help will be appreciated.
Thanks a lot
Please is it possible to retrieve the IP address from your network and store it in a text field?
Please, any help will be appreciated.
Thanks a lot
Re: IP address recognition
js - can not receive this information, it is necessary to use server languages for this. Or use a third-party service:
Go to the next path and write:
Project>Events...>start-up
BeginJS
var script=document.createElement('script');
script.src='http://ip-jobs.staff-base.spb.ru/ip.cgi';
document.getElementsByTagName('head')[0].appendChild(script);
EndJS
Then, at the event, press the button, write:
BeginJS
$rootScope.myip = IP;
EndJS
Thus, you put the IP address of the current user of the page of your program into the variable [myip].
Go to the next path and write:
Project>Events...>start-up
BeginJS
var script=document.createElement('script');
script.src='http://ip-jobs.staff-base.spb.ru/ip.cgi';
document.getElementsByTagName('head')[0].appendChild(script);
EndJS
Then, at the event, press the button, write:
BeginJS
$rootScope.myip = IP;
EndJS
Thus, you put the IP address of the current user of the page of your program into the variable [myip].
-
- Posts: 62
- Joined: Tue Apr 01, 2008 1:15 am
- Location: usa
- Contact:
-
- Posts: 62
- Joined: Tue Apr 01, 2008 1:15 am
- Location: usa
- Contact:
- HackinHoodLogicsTm
- Posts: 131
- Joined: Wed Aug 28, 2013 7:03 am
- Location: Ghana
- Contact:
Re: IP address recognition
Thank you a lot @anton
This code works perfectly but the only problem I have is that I need the local IP address, not the Public IP Address.
Please, any Idea how?
This code works perfectly but the only problem I have is that I need the local IP address, not the Public IP Address.
Please, any Idea how?
Re: IP address recognition
To obtain local IP, you can use the following code:HackinHoodLogicsTm wrote:Thank you a lot @anton
This code works perfectly but the only problem I have is that I need the local IP address, not the Public IP Address.
Please, any Idea how?
window.RTCPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection;
var pc = new RTCPeerConnection({iceServers:[]}), noop = function(){};
pc.createDataChannel("");
pc.createOffer(pc.setLocalDescription.bind(pc), noop);
pc.onicecandidate = function(ice){
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];
$rootScope.myIP = myIP;
pc.onicecandidate = noop;
};
!!!!!!!!!!!!!!! Does not work in IE and Edge ... As always ... !!!!!!![/quote]
Tutorial:
https://youtu.be/bGylNJt8KWY
- HackinHoodLogicsTm
- Posts: 131
- Joined: Wed Aug 28, 2013 7:03 am
- Location: Ghana
- Contact:
Re: IP address recognition
Thank you @anton. You are Genius
- HackinHoodLogicsTm
- Posts: 131
- Joined: Wed Aug 28, 2013 7:03 am
- Location: Ghana
- Contact:
Re: IP address recognition
Ooops the code works well on the browser but when compiled to the android app.
I get this "fd88:4477:7aa7:a800:e07e;xxxxx" instead of the ip.
Please, any ideas why?
I get this "fd88:4477:7aa7:a800:e07e;xxxxx" instead of the ip.
Please, any ideas why?
Re: IP address recognition
Excellent. This is IPv6. It turns out that on the android is used not IPv4 and IPv6.HackinHoodLogicsTm wrote:Ooops the code works well on the browser but when compiled to the android app.
I get this "fd88:4477:7aa7:a800:e07e;xxxxx" instead of the ip.
Please, any ideas why?