<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>