Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OBJECT vs IFRAME video embeds

The question has already been asked as to whether OBJECT or IFRAME should be used for video embedding...

Should I use <object> or <iframe> for loading a video?

But my question takes that a step further. If specifically embedding YouTube videos, is there any advantage to using the OBJECT method, except for those already mentioned in the aforementioned post?

Bearing in mind that the IFRAME will fall back to HTML5 if Flash is unavailable to the viewer, why would anyone want to use the OBJECT method anymore?

David.

like image 722
ArtissTheGeek Avatar asked Nov 01 '12 13:11

ArtissTheGeek


People also ask

What is the difference between object and embed?

The <embed> tag defines a container for an external application or interactive content (a plug-in). The <object> tag defines an embedded object within an HTML document. Use this element to embed multimedia (like audio, video, Java applets, ActiveX, PDF, and Flash) in your web pages.

Should I use video or iframe?

Video elements are more responsive and can be resized across devices like Phone and Tablet. An iframe element, short for inline frame, is an HTML element that allows an external webpage to be embedded in an HTML document. There are no options to hide controls or loop iframes.

Is object safer than iframe?

Another reason to use object over iframe is that object sub resources (when an <object> performs HTTP requests) are considered as passive/display in terms of Mixed content , which means it's more secure when you must have Mixed content .


1 Answers

The <object> embed has a few differences. If you're writing a flash application, you won't be able to embed an iframe. So using the swf will work for those environments. The API also only support IE8 and above due to be implemented with postMessage. If you are just embedding the video the <iframe> will work great, but if you want access to the API your users will have to have IE8 or above.

The <iframe> is the supported and preferred method to use by YouTube. In addition to what already mentioned about the ability to get HTML5 playback (which is the biggest advantage), the API is richer and consistent with our other embedable content.

like image 66
Greg Schechter Avatar answered Sep 27 '22 18:09

Greg Schechter