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 we 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.
At there Webmasters Help Forum, Google clearly stated that iframes may cause problems for them:
Google supports frames and iframes to the extent that it can. Frames can cause problems for search engines because they don't correspond to the conceptual model of the web. In this model, one page displays only one URL. Pages that use frames or iframes display several URLs (one for each frame) within a single page. Google tries to associate framed content with the page containing the frames, but we don't guarantee that we will.
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.
We strongly advise you stay away from using the iframe tag.