Web Performance Optimization & Lighthouse · درس

التحميل المسبق وتلميحات الموارد

استخدم preload وprefetch وpreconnect وتلميحات الأولوية لجلب موارد المسار الحرج مبكرًا وتقليل الوقت حتى أول عرض ذي معنى.

الدرس 4 من 413 خطوة

التحميل المسبق وتلميحات الموارد درس مجاني في Web Performance Optimization & Lighthouse على CoddyKit. هذا هو الدرس 4 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Web Performance Optimization & Lighthouse، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Web Performance Optimization & Lighthouse 4 دروس في المجموع.

بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.

Helping the Browser Prioritize

The browser discovers resources as it parses HTML, but key assets like fonts or hero images may be found late. Resource hints let you tell the browser what to fetch early, shrinking the critical path.

preconnect

preconnect opens the DNS + TCP + TLS connection to an origin ahead of time, so the actual request starts faster. Ideal for font and CDN origins.

<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>

dns-prefetch

dns-prefetch is a lighter hint that resolves only DNS. Use it as a fallback for browsers without preconnect or for many third-party origins.

<link rel="dns-prefetch" href="https://analytics.example.com">

preload

preload fetches a specific resource the current page needs soon, at high priority. Always set the correct as attribute so the browser assigns the right priority and reuses the fetch.

<link rel="preload" href="/fonts/inter.woff2" as="font" type="font/woff2" crossorigin>

Preloading the LCP Image

The hero image driving Largest Contentful Paint is often discovered late. Preloading it can cut LCP significantly.

<link rel="preload" href="/hero.webp" as="image" fetchpriority="high">

prefetch

prefetch fetches resources for a future navigation at low priority during idle time. Great for the next page a user is likely to visit.

<link rel="prefetch" href="/dashboard.js">

Priority Hints

The fetchpriority attribute nudges relative priority. Mark the hero image high and below-the-fold or non-critical assets low.

<img src="/hero.webp" fetchpriority="high" alt="Hero">
<img src="/footer-logo.png" fetchpriority="low" alt="Logo">

modulepreload

For ES modules, modulepreload preloads a module and its dependency graph, avoiding the waterfall of discovering imports one by one.

<link rel="modulepreload" href="/app.mjs">

Avoiding Over-Preloading

Hints compete for bandwidth. Preloading too much delays truly critical resources and can hurt performance. Preload only assets that are critical and discovered late.

Verifying Hints

Check the DevTools Network panel: preloaded resources show high priority and early start times. Lighthouse flags both missing preloads for the LCP element and unused preloads.

Choosing the Right Hint

  • preconnect warm up an origin.
  • preload critical asset for this page.
  • prefetch asset for the next page.
  • fetchpriority fine-tune relative order.

Quick Check

You want a hero image that drives LCP to download as early and as high priority as possible. Which hint fits best?

Recap

You learned to steer the critical path with resource hints: preconnect/dns-prefetch for connections, preload/modulepreload for current-page assets, prefetch for future pages, and fetchpriority to fine-tune. Use them sparingly and verify in DevTools.

البدء مجانًا

تعلم Web Performance Optimization & Lighthouse مع معلم ذكاء اصطناعي — مجانًا

اكتب وقم بتشغيل أكوادك الفعلية في المتصفح، واحصل على مساعدة فورية من معلم ذكاء اصطناعي متاح 24/7، واستمر من حيث توقفت على الويب أو في التطبيق.

الدورات
12
الدروس
48

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

هل درس «التحميل المسبق وتلميحات الموارد» مجاني؟

نعم — نص درس «التحميل المسبق وتلميحات الموارد» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Web Performance Optimization & Lighthouse، انتقل إلى CoddyKit PRO. تتضمن دورة Web Performance Optimization & Lighthouse 4 دروس في المجموع.

ماذا ستتعلم في «التحميل المسبق وتلميحات الموارد»؟

استخدم preload وprefetch وpreconnect وتلميحات الأولوية لجلب موارد المسار الحرج مبكرًا وتقليل الوقت حتى أول عرض ذي معنى. تتمرن على Web Performance Optimization & Lighthouse مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.

هل أحتاج إلى خبرة سابقة لأبدأ Web Performance Optimization & Lighthouse؟

لا تُشترط خبرة سابقة. Web Performance Optimization & Lighthouse على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 4 من أصل 4.

كم من الوقت يستغرق درس «التحميل المسبق وتلميحات الموارد»؟

معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.

هل يمكنني كتابة وتشغيل أكواد في درس Web Performance Optimization & Lighthouse هذا؟

نعم. كل درس في Web Performance Optimization & Lighthouse يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.

جميع الدروس في هذه الدورة

  1. فهم المسار الحرج
  2. الموارد الحاجبة للعرض
  3. ترتيب أولوية المحتوى للسرعة
  4. التحميل المسبق وتلميحات الموارد
← العودة إلى Web Performance Optimization & Lighthouse