2

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?

2 Answers 2

2

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.

1
1

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: http://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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.