[英]Is there a way to configure firebase.json file to serve different html files based on screen size?
I have a website configured through Firebase Hosting.我有一个通过 Firebase 托管配置的网站。 I'm using adaptive web design technique to serve a different html file for desktop vs. mobile devices.
我正在使用自适应 web 设计技术为桌面设备和移动设备提供不同的 html 文件。 Essentially, I have two different html files, that are responsive, but I wanted to serve one on desktop and one on mobile.
本质上,我有两个不同的 html 文件,它们是响应式的,但我想在桌面上提供一个,在移动设备上提供一个。 Is there a way to configure the firebase.json file to do this?
有没有办法配置 firebase.json 文件来执行此操作? Right now, I just have my website serving the index.html file, which is the desktop version.
现在,我的网站只提供 index.html 文件,这是桌面版。 To get to the mobile version, I must add the "mobile.html" at the end of the url.
要获得移动版本,我必须在 url 的末尾添加“mobile.html”。
Here's my json file currently.这是我目前的 json 文件。
{
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
Firebase Hosting doesn't provide a way to detect the type or size of mobile device for the purpose of serving content. Firebase 托管不提供检测移动设备类型或大小以提供内容的方法。
True responsive design is implemented as one set of HTML and CSS that renders correctly for any size and orientation of screen.真正的响应式设计是作为一组 HTML 和 CSS 实现的,可以针对任何尺寸和方向的屏幕正确呈现。 I strongly suggest that you look into how to implement that correctly (hint: use screen size media rules in CSS) rather than depending on the device identifying its capabilities through an HTTP request.
我强烈建议您研究如何正确实现它(提示:在 CSS 中使用屏幕尺寸媒体规则),而不是依赖于通过 HTTP 请求识别其功能的设备。 I'm sure you can find lots of great tutorials and examples of that using a web search.
我相信您可以使用 web 搜索找到很多很棒的教程和示例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.