Mobile app version of vmapp.org
Login or Join
Bryan171

: Is it a good idea to serve other media types in an iframe? I am trying to argue with colleagues that things like <iframe width="200" height="300" src="some-file.pdf" /> (or essentially anything

@Bryan171

Posted in: #Iframe

I am trying to argue with colleagues that things like <iframe width="200" height="300" src="some-file.pdf" /> (or essentially anything that is not of MIME type text/html) are not a good idea.

My own objection is that many browser allow the user to configure that pdf should by displayed by an external application instead of by plugin (or internal browser capabilities). For those users, the iframe would leave an ugly 200x300 blank rectangle while at the same time initiating the start of an external application - and who am I to dictate specific settings to the user?

In your experience, are my assumptions correct?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Bryan171

2 Comments

Sorted by latest first Latest Oldest Best

 

@Harper822

It is definitely not a good idea to use any kind of iframe in your webpage since they are hard and near to impossible to control their correct display to all users, especially the ones with smaller screens.

Ofcourse the most important thing is that they are not working well when it comes to Responsive websites unless you use extra modifications to your html code, mostly creating JS scripts to control their behavior but again you will not cover every displaying scenario by 100%.

Also you need the PDF to have the ability to be zoomed or fit to user's screen something that I believe it is not possible to do it inside an iframe for the whole screen.

10% popularity Vote Up Vote Down


 

@Samaraweera270

Iframes are a great tool, that enjoys near-universal browser support, it's easy to implement and has a number of useful functions. As with any other HTML element, it can be abused, but wielded intelligently it can play a part in a solid UI.

But there are several security vulnerabilities, check this article: www.thespanner.co.uk/2007/10/24/iframes-security-summary/ you can avoid this but you have to be aware.

pros:


Helps with slow third-party content like badges and ads
Security sandbox
Download scripts in parallel


cons:


Costly even if blank
Blocks page onload
Non-semantic

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme