Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to get ip address and port from url in javascript

<script>
var url = 'http://192.168.1.52:8080/home/client.html';
var ip = url.split('/')[2].split(':')[0];
var port = url.split('/')[2].split(':')[1];
</script>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #ip #address #port #url #javascript
ADD COMMENT
Topic
Name
1+9 =