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

标签 html visual-studio-code server liveserver

我在 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。我也遵循官方指示。在我的移动设备上仍然无法使用.. enter image description here

还有其他方法吗?

最佳答案

只需将您的手机与笔记本电脑/PC 热点连接,然后转到 cmd 并输入 config 并获取您的 IP 地址,然后将您的服务器 IP 地址放入它将运行的浏览器中:)

关于html - 我如何使用 vscode 中的实时服务器在移动设备上查看我的 html 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67261468/

相关文章:

git - Git历史记录作为常规文件

Curl 不会在 HTTP POST 请求中发送整个表单数据

apache - Phusion Passenger 内部服务器错误

javascript - 使用鼠标单击/箭头键突出显示行

javascript - 单击突出显示文本(javascript jquery html)

javascript - 如何在播放 HTML 5 视频(如 Youtube 广告)时添加图像/DIV?

javascript - 将不同的变量传递到同一页面

node.js - 我应该如何将我的语言服务器与我的客户端打包在一起?

TypeScript AST 转换删除所有空行

swift - 如何在 Swift Vapor 中使用异步创建的正文 block 生成响应正文