Skillpedia
النشر والسحابة (DevOps)75k · #2938

mime-type

ما الذي تفعله

تتحقق هذه المهارة من ترويسات نوع المحتوى التي يرسلها الخادم مع HTML وCSS وJavaScript والصور والخطوط. وهي موجهة إلى من يدير خوادم الويب أو يشخّص موارد الصفحة المعطلة.

متى تستخدمها

  • ✓عندما تطلب من الوكيل التحقق من أن الخادم يرسل أنواع الملفات الصحيحة.
  • ✓عندما لا تُحمَّل ورقة أنماط أو سكربت وتشك في أن نوع المحتوى خاطئ.
  • ✓عندما تضبط استضافة جديدة أو إطار عمل جديد وتريد التأكد من صحة ترويساته.

رابط المهارة

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/mime-type/SKILL.md

انسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.

طريقة الاستخدام

أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.

رسالة جاهزة للصق

استخدم هذه المهارة لمساعدتي: https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/mime-type/SKILL.md اقرأ ملف SKILL.md في هذا الرابط ونفّذ تعليماته لمهمتي.
تريد أن يجد الذكاء الاصطناعي مهارات مثل هذه بنفسه؟ثبّت خادم Skillpedia MCP المجاني: سطر واحد، ويبحث في 15,000+ مهارة قبل كل مهمة.ثبّته في دقيقة واحدة →

مثال على ما تطلبه من الذكاء الاصطناعي

“ملف CSS لا يُحمَّل في موقعي. هل تستطيع التحقق مما إذا كان الخادم يرسل نوع المحتوى الصحيح؟”

5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.

كيف تعمل

يفحص الوكيل ترويسات الاستجابة للصفحات الرئيسية والملفات المرتبطة بها. ويقارن كل نوع بالنوع المتوقع، مثل text/css لأوراق الأنماط، ويقترح تغييرات في الخادم عند عدم التطابق.

المحتوى التقني (ملف SKILL.md الأصلي)

النص الأصلي من المؤلف، مباشرة من GitHub.

MIME Type Validation

Incorrect MIME types cause browsers to block stylesheets and scripts (MIME sniffing is disabled by X-Content-Type-Options: nosniff), breaking page rendering and signalling poor site quality to crawlers.

Quick Reference

  • The Content-Type header must match the actual file type being served
  • HTML pages must be served as text/html; charset=utf-8
  • CSS files must be served as text/css and JavaScript as text/javascript
  • Incorrect MIME types cause browsers to block or mishandle resources

Check

For key pages and their linked resources, inspect the HTTP Content-Type response header. Verify HTML responses use text/html; charset=utf-8, CSS uses text/css, JS uses text/javascript, and images use image/jpeg, image/png, etc.

Fix

Update your server configuration to serve each file type with its correct MIME type. Set X-Content-Type-Options: nosniff to prevent browsers from guessing content types. In Next.js and similar frameworks, configure headers in next.config.js.

Explain

The Content-Type header tells browsers and crawlers what kind of content is being sent. When it mismatches the actual file type, browsers either block the resource or render it incorrectly—CSS served as text/plain won't be applied, and JavaScript served as text/html may be blocked by strict MIME checking.

Code Review

For HTML, CSS, and JS assets, check the Content-Type response header. Verify HTML responses include 'charset=utf-8'. Check that X-Content-Type-Options: nosniff is set. Flag any resource returning Content-Type: text/html that is not an HTML page. Check for missing charset declarations on text responses.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/seo/mime-type

الأسئلة الشائعة

ماذا يحدث عندما يكون نوع المحتوى خاطئًا؟

قد تحجب المتصفحات الملف أو تعرضه بشكل خاطئ، فقد لا تُطبَّق ورقة الأنماط أصلًا.

ماذا يفعل nosniff؟

ترويسة X-Content-Type-Options تخبر المتصفحات بألا تخمّن النوع، فتعتمد على القيمة التي يرسلها الخادم.

كيف يُضبط هذا في Next.js؟

تقترح المهارة ضبط الترويسات في ملف next.config.js.

التفاصيل

الوصف الأصلي من المؤلف

Use when auditing server configuration or diagnosing broken resources. Applies to any web server serving HTML, CSS, JS, images, fonts, or other static assets.

repo: thedaviddias/Front-End-Checklist

الشعبية

نجوم GitHub
75k
الترتيب
#2938
الترخيص
MIT
آخر تحديث
31‏/10‏/2026

هل هذه المهارة مفيدة؟

0

سجّل الدخول للتصويت.

التعليقات

  • …

المزيد من المهارات من هذا المستودع

مهارات مشابهة