Let's I have two server running on my PC. server1 and server2....
- In server1 there is a html page.(ex. a.html)
- In server2 there is another html page.(ex b.html)
- Server1 is running on port 80
- Server2 is running on port 8080
In a.html of server1 there is a tag. Now I want to access b.html from server2 by the above link that's why I have written
<a href="localhost:8080/b.html">
It's working really well if I access a.html and click that link working fine in my computer where both servers are running.
...... I want to access a.html from server1 in my phone. My pc and phone both are in the same wifi network.
To solve this problem I opened my phone browser and gave my pc ip ex. 192.168.0.1/a.html
It's working fine. But as I said in above that there is a link in that page (ex given above). When I click on that link it's giving error
This site can't be reached localhost refused to connect
.... I know where is the problem . The problem is in the link because I explicitly wrote localhost:8080 . Here is the problem. I should write my pc private it instead of localhost then it'll work I know. But how to get my private IP by javascript to modify the link dynamically by javascript.
Help me to solve this problem.