如何使用 vscode 中的实时服务器在移动设备上查看我的 html 文件?

how can i see my html file on mobile device using live server in vscode?

我在 PC 上使用 windows10 专业版,在移动设备上使用 android。我遵循了下面的这个过程。

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。我也遵循了官方指示。仍然不能在我的移动设备上工作..

还有其他方法吗?

只需将您的手机与 laptop/PC 热点连接并转到 cmd 并输入配置并获取您的 IP 地址并将您的服务器 IP 地址输入浏览器即可 运行:)

哦,我找到了!!!!如果有人使用 public wifi,请不要那样做...它只能在私人 wifi 上工作。谢谢大家帮助我,我爱你们!!!!