What is an iFrame?

Last modified: February 23, 2020


An iFrame (inline frame) is a way to add another HTML document inside another webpage. The iFrame can be any size on a website page, and can be used to embed something that is from an external source to your WordPress website.

The iFrame may or may not include JavaScript and/or CSS. If it does, that code is loaded at the same time as the iFrame.

There are numerous reasons why iFrames are used within a WordPress website. One of the most typical options is embedding a YouTube video. Or alternatively, it could be used to host games that have been developed by third-parties and can be played on other sites.

<iframe width="640" height="480" src="//www.youtube.com/embed/qzO1t1tWHCg?rel=0" frameborder="0"></iframe>

The above code is an example of an iFrame that will play a YouTube video. It determines the size of the frame as 640 by 480. It also includes the details for how much of a border there should be. The script loads the YouTube video player.

Another example of an iFrame is:

<iframe width="700" height="550" src="https://google.com"></iframe>

Many websites will provide you with the best code to insert into your WordPress website when you want to use elements from their website. Many web analytic service providers, social media networks, game sites and video sharing sites also offer code in an iFrame format to include on your website.

However, you need to be careful when you’re using iFrames on your website. Only embed the code on your website if you’re sure of the reliability and trustworthiness of the supplier of the iFrame. And double check the identity of the website.

Hackers have been known to use iFrame in a WordPress website to gain access to the admin area. The code loads itself in an iFrame and then the hackers gain remote control of a website. This can therefore lead to hackers stealing information or disabling a website.


Show More

* This button will show the rest of the post and open up an offer from a vendor
Save 4 Later
Email liked links to yourself

    Related glossary Items