One of our customers implemented an iframe on their website. They right away bumped into a layout issue.
This was very typical of the iframe tag. It often creates more problems rather than solving them.
Breaking design is not the only issue with this tag. In this blog post, you will learn the three main reasons why I strongly advise against using the iframe.
Reason #1. Iframes Bring Security Risks
If you create an iframe, your site becomes vulnerable to cross-site attacks.
- You may get a submittable malicious web form, phishing your users' personal data.
- A malicious user can run a plug-in.
- A malicious user can change the source site URL.
- A malicious user can hijack your users' clicks.
- A malicious user can hijack your users' keystrokes.
Steer clear of using the iframe tag. Don't put your visitors at risk to the XSS attacks.
Reason #2. Iframe Cause Usability Issues
The iframe tag is notorious for creating usability annoyances. Among most common of them are:
- It tends to break the browsers' "Back" button.
- It confuses visually impaired visitors, using screen readers.
- It confuses users, suddenly opening the iframe content in a new browser window.
- Content within the iframe doesn't fit in and looks odd.
- Content within the iframe is missing since the source URL changed.
- Navigation of the site in the iframe stops working.
Find better ways to refer your visitors to external content instead of placing it within the iframe tag.
Reason #3. Iframes Cause SEO Problems
Google recommends refraining from creating iframes.
IFrames are sometimes used to display content on web pages. Content displayed via iFrames may not be indexed and available to appear in Google's search results. We recommend that you avoid the use of iFrames to display content. If you do include iFrames, make sure to provide additional text-based links to the content they display, so that Googlebot can crawl and index this content.
Ditch the iframe tag. Create pages that Google can crawl and associate with your site easily.
You may be facing what seems like a small layout issue with your iframe tag today. You might manage to rectify it now. Only for you and your visitors to get problems with Google, usability or security later.
I strongly advise you stay away from using the iframe tag.