The evil iframe

Working with iframe is always fun for me, it amuse me how easy it is to integrate external content in your own webpage. People say iframe is bad and I agree with it to some extent. Iframe at some places become necessary evil like for a webpage which has to display offers from an external affiliate page or to load a heavy picture gallery which you have on your expensive unlimited hosting on a website hosted on some slower host etc. The root cause of people thinking iframe is evil because some bad guys of internet started using it as an easy way to include malicious files on web pages. But let’s not blame iframe here and when it’s used for good purpose, it has only one problem left and that is with its height. What happens that since one has no control over the content of iframe so the height of the content may change and the iframe height may need to be adjusted frequently which is not feasible in cases where height can change more frequently and at any moment. When height of content becomes more than the height set in iframe code, it shows a scrollbar which looks bad and if you hide the scrollbar, the content gets chopped off from bottom. jQuery has a solution to this problem but it only works when the iframe link is hosted on the same domain where it its used. Now this is pretty much useless as why will someone use iframe for including something that is there on his own site? So problem still remains the same. So for now we have two options, one is to live with scrollbar or to make the height quite large so that it fits the content even if becomes more in height after sometime to avoid scrollbar.

Mohd. Hashim Khan

I work as a freelance web designer and developer and enjoys fiddling with machines and electronics stuff. I am also working as a part time computer teacher at Aligarh Muslim University. I share my knowledge on various topics here so that others can make use of it and take benefit from my experiences.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.