Web Foundations
This lecture explores the fundamental concepts of inline frames (IFrames) and their practical applications in web development. Learn how to effectively use IFrames for embedding content, handling browsers that do not support them, and implementing name/ID anchors for linking. The session includes various demos illustrating how to construct IFrames with links, manage scrolling behaviors, and utilize attributes like src, width, height, and sandbox. Empower your web pages with dynamic content using IFrames!
Web Foundations
E N D
Presentation Transcript
Web Foundations Wednesday, November 6, 2013 LECTURE 25: INLINE FRAMES (IFRAMES), Name/ID Anchors, IFRames with Links and Name/ID Anchors
iframe W3Schools: iframe iframe.html page.html
iframe W3Schools: iframe iframe.html page.html
iframe W3Schools: iframe iframe.html page.html
iframe • Demo Walk-Through • page.html • iframe_empty.html • iframe.html • page1.html • book_TOCpage1.gif • book_TOCpage2.gif • book_TOCpage3.gif • iframe1.html <iframesrc="URL"></iframe> <iframesrc="page.html" width="600" height="800"></iframe> To deal with browsers that do not support <iframe>, add a text between the opening <iframe> tag and the closing </iframe> tag. Example: <iframesrc="page.html">Your browser does not support the iframe tag. How very lame! Don't be a trogladyte! Upgrade to Chrome now!</iframe> W3Schools: iframe
iframe • Demo Walk-Through • page.html • iframe.html • page1.html • book_TOCpage1.gif • book_TOCpage2.gif • book_TOCpage3.gif • iframe1.html <iframesrc="URL"></iframe> <iframesrc="page.html" width="600" height="800"></iframe> To deal with browsers that do not support <iframe>, add a text between the opening <iframe> tag and the closing </iframe> tag. Example: <iframesrc="page.html">Your browser does not support the iframe tag. How very lame! Don't be a trogladyte! Upgrade to Chrome now!</iframe> W3Schools: iframe
Iframe Attributes • src– Specifies the address of the document to embed in the <iframe> • name– Specifies the name of an <iframe> • width– Specifies the width of an <iframe> in pixels • height– Specifies the height of an <iframe> in pixels • srcdoc– Specifies the HTML content of the page to show in the <iframe> • sandbox– Enables a set of extra restrictions for the content in the <iframe> (" " | allow-forms | allow-same-origin | allow-scripts | allow-top-navigation ) • seamless– Specifies that the <iframe> should look like it is a part of the containing document • scrolling– Technically deprecated in HTML5, although it is still supported by all the browsers (yes | no | auto) W3Schools: iframe
Name/ID Anchors • Demo Walk-Through • name0.html • name1.html • name2.html • name3.html It used to be this: <a name="bookmark1"> In HTML5 it has become this: <a id="bookmark1">
iframe with Links to iframe • Demo Walk-Through • page.html • page0.html • iframe0.html <iframesrc="page.htm" name="iframe_a"></iframe> <p><a href="page0.html" target="iframe_a">Page0</a></p>
iframe Using Name/ID Anchors with Links and Scroll, and Links Only • Demo Walk-Through • iframe2.html • iframe3.html • iframe4.html • iframe5.html Difficult JavaScript Solution Easy HTML Solution <iframesrc="page1.html" name="theframe"></iframe> <a href="page1.html#toc1" target="theframe">TOC 1</a> <a href="page1.html#toc2" target="theframe">TOC 2</a> <a href="page1.html#toc3" target="theframe">TOC 3</a>