iFrames Introduction


What is an iFrame? An iFrame is an HTML tag that is used to embed another document within the current HTML document. This content is from http://www.w3schools.com/tags/tag_iframe.asp An inline iframe is marked up in HTML like this:

 <iframe src="http://www.w3schools.com"></iframe> 

An iframe with a specified height and width of 300 pixels would be marked up like this:

<iframe src="http://www.w3schools.com" width="300" height="300"></iframe>

It did not like my width setting of 300 pixels and only displayed 200 pixels wide.

Other Sites

Can other sites use iframes and load your site into their iframe on their web site? Would you want to block them from doing so? First we can run a test using w3schools.com. This web site allows you to test code. The HTML code that makes this test possible is shown below:

<iframe src="demo_iframe.htm" name="iframe_a">
<p>Your browser does not support iframes.</p>
</iframe>
<a href="https://begincodingnow.com" target="iframe_a">Begin Coding Now</a>

Go to w3Schools see it live. Change the code to match the code shown above and click See Result and then click the link on the right side which will read “Mikes Small Business”.