HTML Plug-ins
In this page:
<object data="file-url" type="mime/type" width="width" height="height"></object>
<embed src="file-url" type="mime/type">
Plug-ins का विकास
वेब के शुरुआती दिनों में, ब्राउज़र को media चलाने, games चलाने, या PDFs दिखाने के लिए third-party plug-ins की ज़रूरत होती थी। मॉडर्न वेब स्टैण्डर्ड्स ने इन असुरक्षित plug-ins की जगह native HTML5 टैग्स ले ली हैं, जिससे पेज तेज़ी से लोड होते हैं और ज़्यादा सुरक्षित रूप से चलते हैं।
उदाहरण: The Evolution of Plug-ins
<video src="movie.mp4" controls></video>
object से Resources Embed करना
object टैग एक बहुमुखी एलिमेंट है जिसका उपयोग बाहरी resources (जैसे PDFs, इंटरैक्टिव widgets, या दूसरे वेबपेज डॉक्यूमेंट) को सीधे आपके वेबपेज पर embed करने के लिए किया जाता है, साथ ही इसमें width, height, और type attributes भी होते हैं।
- resource को रेंडर न कर पाने वाले डिवाइसेज़ पर यूज़र की मदद के लिए हमेशा अपने object टैग्स के अंदर fallback टेक्स्ट शामिल करें।
- Accepted attributes:
- data — URL of the resource
- type — MIME type
- width / height — pixels
- name — for targeting
- form — id of an associated form
उदाहरण: Embedding Resources with object
<object data="document.pdf" type="application/pdf" width="600" height="400">
Your browser cannot display this PDF.
</object>
embed से सिंपल Embeds
embed टैग एक और self-closing एलिमेंट है जिसका उपयोग बाहरी resources या इंटरैक्टिव टूल्स को इंटीग्रेट करने के लिए किया जाता है। object टैग के उलट, यह ज़्यादा सिंपल है और fallback कंटेंट को नहीं लपेटता, यह resource को लोड और साइज़ करने के लिए पूरी तरह attributes पर निर्भर रहता है।
- बाहरी टूल्स या widgets को तेज़ी से, आसानी से इंटीग्रेट करने के लिए embed टैग का उपयोग करें।
- Accepted attributes:
- src — URL of the resource
- type — MIME type
- width / height — pixels
उदाहरण: Simple Embeds with embed
<embed src="document.pdf" type="application/pdf" width="600" height="400">
Plug-ins के सुरक्षा जोखिम
बाहरी एप्लिकेशन को embed करना जोखिम भरा हो सकता है, क्योंकि वे आपके पेज पर अनचाही स्क्रिप्ट चला सकते हैं। मॉडर्न ब्राउज़र ने legacy plug-ins की जगह यूज़र सुरक्षा की रक्षा के लिए secure APIs और native sandboxed एलिमेंट्स ले ली हैं।
उदाहरण: Security Risks of Plug-ins
<object data="https://secure.example.com/widget" type="text/html"></object>
मॉडर्न स्टैण्डर्ड विकल्प
मॉडर्न वेब स्टैण्डर्ड्स ने ऐसे native APIs और एलिमेंट्स पेश किए हैं जो पहले plug-ins द्वारा संभाले जाने वाले लगभग सभी काम कर सकते हैं। media playback के लिए video और audio, इंटरैक्टिव ग्राफिक्स के लिए canvas, और बाहरी वेबपेज embed करने के लिए iframes का उपयोग करें।
उदाहरण: Modern Standard Alternatives
<video src="movie.mp4" controls></video>
<canvas id="graphics"></canvas>
<iframe src="https://example.com"></iframe>
Chapter Quiz — Complete all 6 topics to unlock
0/6 topics done
Complete these topics first: