Kiểu MIME .webmanifest: application/manifest+json

Các file có đuôi .webmanifest (Web app manifest) sử dụng kiểu MIME application/manifest+json.

Cập nhật

application/manifest+json
Kiểu MIME cho .webmanifest
Web
Danh mục
Có
Nén bằng gzip/Brotli

Kiểu MIME của file .webmanifest là gì?

Kiểu MIME (media type) của file Web app manifest có phần mở rộng .webmanifest là application/manifest+json. Manifest PWA được liên kết bằng <link rel="manifest">. Trình duyệt cũng chấp nhận application/json.

Header Content-Type

Content-Type: application/manifest+json

Các kiểu dựa trên văn bản nên có charset để trình duyệt giải mã ký tự đúng cách.

Cấu hình máy chủ

Máy chủCấu hình
Nginx (mime.types hoặc types {})application/manifest+json webmanifest;
Apache (.htaccess)AddType application/manifest+json .webmanifest
IIS (web.config)<mimeMap fileExtension=".webmanifest" mimeType="application/manifest+json" />
Node.js / Expressres.type('webmanifest') hoặc res.setHeader('Content-Type', 'application/manifest+json')
Amazon S3Đặt Content-Type: application/manifest+json cho đối tượng (metadata), hoặc truyền --content-type application/manifest+json vào aws s3 cp

File .webmanifest có nên được nén không?

Có. Web app manifest là văn bản, nên bật gzip hoặc Brotli cho application/manifest+json thường giúp giảm 50–80 % dung lượng truyền tải. Hãy đảm bảo danh sách nén của máy chủ có kiểu này — kiểm tra bằng công cụ kiểm tra nén website.

Vì sao kiểu MIME quan trọng

Trình duyệt quyết định sẽ làm gì với một phản hồi — hiển thị, thực thi, phát hay tải xuống — dựa trên header Content-Type, chứ không dựa trên phần mở rộng file. Với X-Content-Type-Options: nosniff, kiểu sai khiến stylesheet và script bị chặn hoàn toàn. Với upload, đừng bao giờ tin kiểu do client gửi lên; hãy kiểm tra nội dung file (magic bytes) trên server.

Câu hỏi thường gặp

Kiểu MIME của .webmanifest là gì?
application/manifest+json.
Làm sao để đặt Content-Type cho .webmanifest trong Nginx?
Đảm bảo application/manifest+json webmanifest; có trong khối types (thường nằm ở /etc/nginx/mime.types) rồi tải lại Nginx.
Có nên nén file .webmanifest bằng gzip không?
Có — định dạng này nén rất tốt, nên hãy thêm kiểu này vào cấu hình gzip/Brotli của bạn.