在 Android 手机上运行在笔记本电脑上的本地网站。

huangapple go评论65阅读模式
英文:

How to run a localhost website in Android phone which is run on laptop

问题

我最近开始开发一个网站。但是,我在本地主机上运行它时遇到了问题。当我在我的Web浏览器中键入http://localhost时。
我最近开始开发一个网站。但是,我在本地主机上运行它时遇到了问题。当我在我的Web浏览器中键入http://localhost时。
css

英文:

I recently started developing a Website. However, I am having trouble running it on localhost. When I type http://localhost in my web browser.
I recently started developing a Website. However, I am having trouble running it on localhost. When I type http://localhost in my web browser.
css

答案1

得分: 1

你的本地主机是代码正在运行的计算机,它的作用类似于服务器,但是在本地。如果你想在手机上访问网站,你需要找到计算机的IP地址。你可以通过打开命令提示符并输入 ipconfig 来获取这个地址,然后查找IPv4地址,可能会有两个,可以尝试其中一个。然后确保你的手机和计算机连接到同一个网络上(例如,让计算机和手机连接到相同的WiFi上。确保WiFi不是私有的),然后你可以在手机上使用这个IP,后面加上端口号,例如 192.158.1.38:4000,其中 4000 是端口号。

根据你的 css 标签,我猜你想测试响应式代码,我建议你检查浏览器的开发工具,方法是右键单击浏览器窗口的任何地方,然后点击检查。从这里,你可以切换到移动视图和桌面视图,甚至选择不同的移动设备,以查看你的网站在这些设备上的外观。

如果你需要更多帮助,请告诉我。希望这对你有所帮助 在 Android 手机上运行在笔记本电脑上的本地网站。

英文:

Your localhost is the machine the code is running on, it acts like a server, but locally. If you want to access the website on your mobile phone, you need to find your computer's IP Address. you can get this by opening a command prompt and typing in ipconfig and checking for the IPv4 address, there might be two, try either of them. Then make sure your phone and computer are connected to the same network (e.g like let the computer and phone be connected to the same WiFi. Make sure the wifi is not private though) you can then use this IP on your phone, followed by the port number for example 192.158.1.38:4000 where 4000 is the port number.

And from you tag of css, I am guessing you want to test responsive code, I can advice you check your browser's dev tools by right clicking on anywhere on the browser window and clicking inspect, from here, you can toggle between mobile and desktop view, or even choose different mobile devices to see what your website will look like on those devices

let me know if you need any more assistance. Hope this was helpful 在 Android 手机上运行在笔记本电脑上的本地网站。

答案2

得分: 0

Follow the steps:
步骤1:打开CMD并输入ipconfig

步骤2:找到类似于IPv4地址:192.168.x.xipv4地址

步骤3:将该地址输入到您的移动手机中,最后添加:PORT PORT=将您的网站运行的端口号写入,它显示在浏览器URLVSCode中的live server扩展中

网址:http://192.168.x.x:PORT

英文:

Follow the steps:
Step 1: open CMD and write ipconfig

Step 2: Find ipv4 address which is look like IPv4 Address : 192.168.x.x

Step 3: write the address into your mobile phone and in the last add :PORT PORT= Write the PORT number on which your website is running it is shown in browser url or live server extension in vscode

url: http://192.168.x.x:PORT

huangapple
  • 本文由 发表于 2023年6月12日 00:44:26
  • 转载请务必保留本文链接:https://go.coder-hub.com/76451502.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定