简体   繁体   English

有没有办法配置 firebase.json 文件以根据屏幕尺寸提供不同的 html 文件?

[英]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.

相关问题 如何配置 firebase.json 中的托管行为以重写 URL? - How to Configure hosting behavior in firebase.json to rewrite URL? Firebase 部署找不到 firebase.json - Firebase deploy could not locate firebase.json 我是否需要手动将大量文件模式放入 firebase.json/hosting/ignore? - Am I expected to manually put lots of file patterns into firebase.json/hosting/ignore? 部署的 Firebase 项目是一个空白页,尽管 firebase.json 指向构建文件夹 - Deployed Firebase project is a blank page, despite firebase.json pointing to the build folder Flutter web 应用程序丢失 firebase.json 并在部署到 firebase 托管时显示“欢迎 Firebase 托管设置完成” - Flutter web app is missing firebase.json and shows "Welcome Firebase Hosting Setup Complete" when deployed to firebase hosting 如何根据大小将大 s3 文件拆分为多个文件? - How to Split the big s3 file into multiple files based on size? 如何根据文件大小处理文件或在aws中计数? - how to process files based on file size or count in aws? 如何将 JSON 文件上传到 firebase - How to upload JSON file to firebase 将文件上传到 firebase 存储和云 firebase 时创建 2 个不同的 url - 2 different urls created while uploading files to firebase storage and cloud firebase 寻找一种使用 firebase 在无服务器 flutter 中存储和读取 json 文件的安全方法 - Looking for a secure way to store and read json file in serverless flutter using firebase
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM