Use of Iframe or Object tag to embed web pages in another
The IFRAME element is part of the upcoming HTML5 standard. Also, HTML5 is developed by the major browser vendors out there (Mozilla, Opera, Safari, IE), that basically makes a guarantee that we will have an IFRAME element in the foreseeable future. Some of them have support for some HTML5 elements already, like AUDIO and VIDEO and some new JavaScript APIs.
It's also true that the OBJECT element is in the draft, but that's because IFRAME and OBJECT will have different purposes. IFRAMES are mainly designed for sandboxing web applications.
So, my advise is to use IFRAME instead of OBJECT.
embed vs. object
OBJECT vs. EMBED - why not always use embed?
Bottom line: OBJECT is Good, EMBED is Old. Beside's IE's PARAM tags, any content between OBJECT tags will get rendered if the browser doesn't support OBJECT's referred plugin, and apparently, the content gets http requested regardless if it gets rendered or not.
object
is the current standard tag to embed something on a page. embed
was included by Netscape (along img
) before anything like object
were on the w3c mind.
This is how you include a PDF with object
:
<object data="data/test.pdf" type="application/pdf" width="300" height="200">
alt : <a href="data/test.pdf">test.pdf</a>
</object>
If you really need the inline PDF to show in almost every browser, as older browsers understand embed
but not object
, you'll need to do this:
<object data="abc.pdf" type="application/pdf">
<embed src="abc.pdf" type="application/pdf" />
</object>
This version does not validate.
Differences between the HTML tags of embed, object, and video?
This might help: http://www.stoimen.com/blog/2009/02/22/html-object-and-embed-tags/
As for the video tag, WMVs wont always work because if you're on a Mac you would have to install a plugin
Embed (iframe or object) and Modify (jQuery) webpage
Here's a link to a similar question:
how to access an iframe and affect it with jQuery
Basically you can't due to Javascript same-origin policy but if you have access to the loaded content in the iframe you could use window.postMessage
You could also add a parameter to the iframe's src tag to post a message, something like this:
<iframe src="http://www.example.com?hideElement=true"></iframe>
Again you will have to have access the content of the iframe to check the param and execute your code.
Related Topics
How to Prevent Input Type="Number" Getting Negative Values
Ng-App Vs. Data-Ng-App, What Is the Difference
Difference Between ≪Input Type='Submit' /≫ and ≪Button Type='Submit'≫Text≪/Button≫
Html Table With Horizontal Scrolling (First Column Fixed)
Select Dropdown With Fixed Width Cutting Off Content in Ie
Href Overrides Ng-Click in Angular.Js
What Is Use of 'Initial' Value in Css
How to Align Two Divs Horizontally
Setting Transform-Origin on Svg Group Not Working in Firefox
Hide Vertical Scrollbar in ≪Select≫ Element
Color of Stacked Semi-Transparent Boxes Depends on Order
Multiple ≪Html≫≪Body≫ ≪/Html≫≪/Body≫ in Same File
How to Center Nav-Items in Bootstrap
How to Display Vertical Text in Table Headers with Auto Height/Without Text Overflow