What is an iframe, and how is it used in html?
-
2Is searching really so difficult these days? google.com/search?q=iframe. I'm wondering if this is even a serious question.Andy E– Andy E2010年06月05日 10:00:06 +00:00Commented Jun 5, 2010 at 10:00
-
1I believe this is a valid question. Check out: meta.stackexchange.com/questions/8724/… which may indicate stackoverflows objective. If anything, you might get a better reponse from html questions at doctype.com . Maybe one day we will be telling people to 'just stackoverflow it' but until then we need to continue compiling real answers.krock– krock2010年06月05日 10:28:15 +00:00Commented Jun 5, 2010 at 10:28
4 Answers 4
An iframe is an object that allows you to embed external content in your HTML page. You can use it to display other web pages, documents (e.g. PDF) etc (although for complex media types you may want to try the object tag instead).
You can add an iframe to your page like so:
<iframe src ="externalContent.html" width="400" height="300">
<p>Your browser does not support iframes.</p>
</iframe>
The p tag inside will display if iframes are not supported by the browser being used.
Comments
The iframe element denotes an inline frame, simple as that.
Example usage:
<iframe src="foo.html">
<p>Your browser does not support <code>iframe</code> elements.</p>
</iframe>
Comments
Example of iframe - https://jsfiddle.net/vsaurabhaec/jsgbncf0/
Example with url :
<iframe src="https://www.findertoday.com/address-finder/address/Bhagatpur+Tea+Garden-9953?width=500&access_method=findertoday" target="_parent" width="500" height="270" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowTransparency="true"></iframe>
Example with content :
<iframe id="FileFrame" src="about:blank">
<html><body>test</body></html>
</iframe>
NB : iframe need some security awareness. css and js does not have control over inner part of iframe and this is advantage of iframe ( some time )
Comments
An iframe is an HTML element that allows an external webpage to be embedded in an HTML document.
In other words, it’s a website within a website. It’s like embedding a chrome or firefox tab within a page, except that it doesn’t have any toolbars or an address bar or anything visible other than the web page that’s loaded. This allows developers to load one web page within another without the user necessarily knowing that they are separate pages. An iframe may load something as simple as a single like button to an entire web page or documents like pdf and many more.
For example
<iframe src="https://www.birthdaycalculatorbydate.com" width="600px" "height="800px" align="center" scrolling="yes"></iframe>
Original content is from iframeinhtml.com