【发布时间】:2015-02-08 16:48:37
【问题描述】:
.trPic{
width:640px;
height:480px;
position:absolute;
top:0px;
left:0px;
width:640px;
height:480px;
background: url(http://192.168.2.150:8090/?action=stream) no-repeat;
border:0px solid #000000;
}
我可以在 Css 上获取主机名吗?像 (http://hostname:8090/?action=stream) 因为我的服务器在不同的端口上运行,当我的 ip 更改或有人从局域网外连接时,我看不到流...
当我的 ip 更改示例:192.168.43.187 我必须将 css 文件更改为并且 localhost 使用 127.0.1.1 并且当我想流出 lan 时我必须将 css 更改为 http://publicip:8090/?action=stream
【问题讨论】:
-
是的,应该可以,但是你没试过吗?
-
使用 localhost 可能不是一个好主意。但是,您可以使用像
/?action=stream这样的相对引用 - 请注意,静态媒体需要配置为在此 url 上正确服务 -
去探索 /etc/hosts 或 Windows\System32\drivers\etc\hosts(Linux/Windows 依赖)并查看 localhost 是如何定义的,然后添加您自己的输入。
-
@GavinSimpson 我试过了,但是在局域网外并且我的本地 ip 更改时它无法正常工作......