iframe alternative to HTML5 for pdf view
The <iframe>
is not deprecated at all. At least, the current HTML5 spec draft on <iframe>
doesn't say anything about deprecation. In the future please read the specification itself before making ungrounded assumptions.
There's however an alternative to the <iframe>
which allows graceful degradation: the <object>
tag which in the below example gracefully degrades to a link when the specified content type is not supported by the browser nor any of its plugins (you know, displaying a PDF file inline requires the Acrobat Reader plugin).
<object data="/url/to/file.pdf" type="application/pdf" width="500" height="300">
<a href="/url/to/file.pdf">Download file.pdf</a>
</object>
Alternative to iframe
There is one alternative to <iframe>
and that's the <object>
tag. It can display content from different sources as well. The pro is it being conform to the xhtml-standards and encouraged to use but there's not such a broad / usable support in older browsers (you have to mess with it to get it right in IE). It's used as followed:
<object data="page.html" width="400" height="300" type="text/html">
Alternative Content
</object>
That being the direct answer to you question I don't think it will give you any speed advantage. Already for the reason that the <iframe>
-element is much more used and so more tested and cared for than <object>
.
I for myself never saw an <iframe>
being the cause for a slowdown, but that still might be possible. If that is an option, you should definitely try what ocanal said before in the comments: Let your script work on an wrapper container-div instead of the body-element and so embed it directly on the mainpage.
For the browser it shouldn't be much more than some overhead from handling a second document, so you could guess that it's just that little more to make your pc run slow. So it might be a good idea to optimize the code in general:
Look if you can find the bottleneck causing the slowdown. Possible causes could be
- altering the DOM a lot - which is always slow
- acting a lot on things not even visible on screen
getting attributes from objects. For every additional period you use it means more work for your cpu:
// instead of using this over and over again
house.roof.window.handle.open();
house.roof.window.handle.close();
// save it to a var and use that instead
var handle = house.roof.window.handle;
handle.open();
handle.close();
- Updating the game in short equal intervals by
window.setTimeout()
may also be too fast and waste cpu power unnecessarily (or too slow and won't look fine then, but never really right) - so you can use the newwindow.requestAnimationFrame
. The vendor-prefixed variants are implemented in the current versions of all important browsers and it's easy to provide a fallback to the old method. - As a last thought: Maybe it even helps in some meta-magical way to include the script file itself on the mainpage and not in the embeded document
Html5 frames alternative
You can use Iframes for this:
<iframe src="http://example.com/form.php" name="myform"> // or src="path/to/your/form.php"
// the content of your Iframe goes here...
</iframe>
http://www.quackit.com/html_5/tags/html_iframe_tag.cfm
http://webdesign.about.com/od/iframes/a/html5-iframe-attributes.htm
Related Topics
Angular Material Table - Apply Dynamically Background Color to a Row (Angular 2+)
Call Method from HTML Only One Time in Angular2
Selecting an Option in a Dropdown List Using Request Parameters
Limit Number of Digits After Decimals in Text Input
How to Set Space Between Contained Divs
How to Detect When Cancel Is Clicked on File Input
How to Manually Trigger Click Event in Reactjs
Align Text At Same Horizontal Align as Image
Make Div (Height) Occupy Parent Remaining Height
How to View HTML File in Remote Unix Server
How to Display Dynamic Json Data in HTML Using Angular 6
Alternative to Iframes With Html5
How to Horizontally Center an Element
Vertical-Align With Bootstrap 3
Html Table With 100% Width, With Vertical Scroll Inside Tbody