我在 PC 上使用 windows10 pro,在移动设备上使用 android。我遵循了下面的这个过程。
Why can't I enter the url on my phone's browser to view my live site?
127.0.0.1 is a special-purpose IPv4 address reserved for loopback purposes. That is, this IP refers to >your computer itself.
By entering http://127.0.0.1:5500/index.html in your browser, you're requesting web page within your >computer.
In normal case, your computer will be in a NAT network (under same wi-fi AP for instance), and you'll be >assigned with a virtual IP. Normally it's 192.168.x.x.
You may enter the following command in your command prompt to see your IP address.
ipconfig
As a result, under your network interface card, you'll get your IP Address.
If the IP address belongs to virtual IP, then you may access it with your phone using
http://< Your IP Address >:5500/index.html
If it's not virtual IP, it is Public IP. Then, you'll have to configure appropriate Firewall settings >under this circumstance.
Hope this will help.
然后我就完成了:控制面板 -> Windows Defender 防火墙 -> 允许应用程序或功能通过 Windows Defender 防火墙 -> 允许“code.exe”应用程序。
但在我的移动设备上,仍然存在 ERR_ADDRESS_UNREACHABLE。我也遵循官方指示。在我的移动设备上仍然无法使用..
还有其他方法吗?
最佳答案
只需将您的手机与笔记本电脑/PC 热点连接,然后转到 cmd 并输入 config 并获取您的 IP 地址,然后将您的服务器 IP 地址放入它将运行的浏览器中:)
关于html - 我如何使用 vscode 中的实时服务器在移动设备上查看我的 html 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67261468/