Thursday, 1 July 2021

*Episode 13.3* HTML (Frames)

 



Working with Frames in Browsers not Supporting this Feature


       Frames are supported only by version 2 and higher of Netscape navigator and Microsoft Internet Explorer. When someone accesses a page containing frames with a browser that doesn't support this feature, nothing is displayed how do you solve this problem? In these cases, use the <NOFRAMES> command, which allows the inclusion of warning or HTML commands that can be viewed by the browser. When a browser that doesn't support frames find the <FRAMESET> or <FRAME> commands, it simply ignore these commands.

       The <NOFRAMES> command works like a container within the structures of the <FRAMESET> command. Within it, any HTML commands may be specified. These commands are only executed if the frameset cannot be loaded by the browser.

        Take into consideration users whose browsers don't support frames. We suggest the following alternatives when creating your page with frames:


  1. Use the <NOFRAMES> commands and issue a warning that the browser used does not accept frames. You can even suggest addresses from which a new version of the browser may be downloaded. (This example will be shown below.)
  2. Create an initial page that allows the user to choose between viewing a version with frames or another without frames.
Use the<NOFRAMES> command to automatically load a version without frames from your site. (This example will be shown in the next section, "including help pages.")


       The first option requires the least work; however, you will lose many users who do not have a compatible browser.

       The last two alternative, particularly the last, are the best from an operational point of view; however, they require more development work.

       As an integral part of all the pages created with frames, you should use a <NOFRAMES> command with standard text advising about the need to use a compatible browser or to activate alternative pages. Examine the basic source code of a document using this technique below:


NOFRDEMO.HTM File:-


 <HTML>

 <HEAD>

 <TITLE>Noframes</TITLE>

 </HEAD>

 <FRAMESET cols=35%,65%>

 <FRAME src=c.htm>

 <FRAME src=b.htm>

 <NOFRAMES>

 </P>This page uses Frames, a feature not supported by the Browser being used. We suggest obtaining an updated version of Netscape navigator 4 or Internet Explorer 4 through the following sites:

 <P>

 Microsoft: <A HREF="http://www.microsoft.com">http://www.microsoft.com</A>

 <P>

 Netscape: <A HREF="http://home.netscape.com">http://home.netscape.com</A>.

 <P>

 </NOFRAMES>

 </FRAMESET>


     Here is the result of the code displayed by a browser that supports frames:

 



       And this is what happens when the browser cannot display frames (this example is displayed in word, however, rather than a browser):




Including Help Pages


        Our second project consists of creating and expanding the capabilities of the electronic manual by adding a help page. This window will be at the bottom of the browser window, and will display the contents of help files associated with some term selected, or else to display an overall description of the system. In addition to providing online help, this document may be viewed by a browser not supporting frames.


MENUFRA2.HTM File:-


 <HTML>

 <HEAD>

 <TITLE>menufra2.htm</TITLE>

 </HEAD>


 <FRAMESET rows=80%,*>

 <NOFRAMES><BODY bgcolor="#ffffee">

 <H1><CENTER>Main menu</H1></CENTER>

 <UL>

 <LI><A HREF=a.htm>Introduction</A>

 <LI><A HREF=b.htm>Chapter 1</A>

 <LI><A HREF=c.htm>Chapter 2</A>

 <LI><A HREF=d.htm>Chapter 3</A>

 <LI><A HREF=e.htm>Chapter 4</A>

 <LI><A HREF=f.htm>Chapter 5</A>

 </UL>

 </body>

 </NOFRAMES>

  <FRAMESET cols=30%,*>

  <FRAME name="menu" src=indcap2.htm>

 <FRAME name="texts" src="nothing.htm">

 </FRAMESET>

 <FRAME name="help" src="nothing.htm"></FRAMESET>

 </frameset>


 </html>


    Note in the code above that the <NOFRAMES> command contains the code of the main menu of the manual.

        We used the same frames structure of the MENUFRAM.HTM document, except that this time, a document called NOTHING.HTM is automatically loaded to the frames called text and help. This NOTHING.HTM document contains only the code required to change the background colour.


NOTHING.HTM File:-


 <html>

 <head>

 <title></title>

 </head>

 <body bgcolor="#80FFFF">

 </body>

 </html>


   The INDCAP2.HTM file is a variation of the INDCAP.HTM document. It contains a mention of a new chapter of the manual and adds two more links, which are shown after the menu. See the code below:


 <html>

 <head>

 <title>Main menu</title>

 <base target="texts">

 </head>

 <body bgcolor="#FFFFEE">

 <h1 align=center>Main menu</h1>

 <ul>

 <li><a href="a.htm">Introduction</a></li>

 <li><a href="b.htm">Chapter 1</a></li>

 <li><a href="c.htm">Chapter 2</a></li>

 <li><a href="d.htm">Chapter 3</a></li>

 <li><a href="e.htm">Chapter 4</a></li>

 <li><a href="f.htm">Chapter 5</a></li>

 <li><a href="g.htm">Chapter 6</a></li>

 </ul>

 <p align=center><a href="sos.htm" target="help">Enables help</a><br>

 <a href="nothing.htm" target="help">Disables help</a> </p>

 </body>


 </html>


   The first link, if it is activated, loads a file called SOS.HTM to the the help window. The second link clears the contents of the help window. To do this, it simply loads the NOTHING.HTM file back to that window. 

      The new chapter, which is called G.HTM is shown next. It contains simple text in which a key word, which is this case is "frames," has explanatory text associated with it. Clicking on this word loads the FRAMEHLP.HTM file, which contains the explanation of the term, to the help frame.

       After reading the text, the user can press the disable help option of the main menu to clear the help window.

       Here is the source code:


  <html>

 <head>

 <title>Chapter 6</title>

 </head>

 <body bgcolor="#FFFF80">

 <h1>Chapter 6</h1>

 <hr>

 <p>This chapter describes some basic concept related to the use of the features of <a href="framehlp.htm" target="help">frames </a>and their use in the creation of homepages.</p>

 <ul>

 <li>What are Frames</li>

 <li>General syntax</li>

 <li>Practical examples</li>

 </ul>

 <p>&#160;</p>

 <hr>

 <h5>Jose; Antonio Ramalho.<br>

 Copyright &#169; 1998 J.Ramalho Assessoria e Treinamento<br>

 </h5>

 </body>


 </html>


    The next figure shows the browser displaying the generic help after the enables help link is the main menu was pressed.




      The next illustration shows Chapter 6 being displayed.




       To eliminate the help text, click on the disable help option of the main menu. The next figure shows what happen when the word "Frames" is clicked.




Frame Nesting


      You can nest framesets and create complex frame structures. To nest a frameset within another, use the <FRAME> command to load a document containing a frameset definition. Suppose you have a main document which defines a frameset with two horizontal windows, as shown below.


    x.htm          
    ywz.htm


 <html>

 <head>

 <title>A</title>

 </head>

 <frameset rows=*,*>

      <frame src=x.htm>

      <frame src=ywz.htm>

 </frameset>

 </html>

  

   In the top window you load in normal HTML document called X.HTM. In the lower Windows, load a document containing a new frames definition called YWZ.HTM, as shown below.


    y.htm           w.htm            z.htm    


 <html>

 <head>

 <title>YwZ</title>

 </head>

 <frameset cols=*,*,*>

      <frame src=y.htm>

      <frame src=w.htm>

      <frame src=z.htm>

 </frameset>

 </html>


   The result is a window composed of two sets of frameset.


      x.htm      
      y.htm         w.htm             z.htm       


       It's quite simple, isn't it? However, the more nested framesets, the more complicated the navigation. See how the MASTER.HTM document looks when loaded.




Names of Special Windows

       To completely master the use of frames, it is important to know the purpose of four special Windows which are predefined. Using these names in the TARGET attribute prompt the browser to load the document to certain windows.

TARGET="_blank":-

     The name "_blank" causes a new window to be opened to load the document. This opened window has no name.

TARGET="_self":-

     The name "_self" causes the document loaded to be displayed in the same window as the link.

TARGET="_parent":-

      This name causes the link to be loaded to the frameset of the level above that of the current document.

TARGET="_top":-

       The name "_top" causes the document to be loaded using the full browser window, thus breaking the appearance of the document frames.

Opening a New Browser Window (_blank)

        This TARGET option starts a new browser session and displays the document in the full browser window. Therefore, there will be two browsers running at the same time. After viewing the content of the new window, the user should close the second browser. The X.HTM file contains this example.

X.HTM File:-

 <html>
 <head>
 <title>x</title>
 </head>
 <body bgcolor="yellow">document xX<p>
 <a href="x.htm" target="_blank">Load X in a new window (_blank)</a><p>
 <a href="ywz.htm" target="trio">Load Windows Y,W and Z in their original position</a><p>
 <a href="master.htm" target="_top">Reloads the master frameset</a>
 </body>
 </html>

   See the result of the link using _blank:



Loading a Document in the Current Window (_self)

       If you wish to load a document to the window where the link is, superseding the the <BASE TARGET="window name"> command, use _self as destination. The Z.HTM file shows the loading of the X.HTM document to its own window.

Z.HTM File:-

 <html>
 <head>
 <title></title>
 </head>
 <body bgcolor="cyan">document z<p>
 <a href=x.htm target=_self>Loads X.htm in its own window</a>
 </body>
 </html>

   See the result:


  
       The X.HTM document it is loaded to the window of document Z.

Loading a Document in the Main Window (_top)

      Through the use of _top you can load to the browser's main window, that is, overlay all the current frames with the content of the new document. The W.HTM file shows the use of this option. This feature can be used to zoom in a window. which would assume the full size of the screen, or to disable the display of the other frames.

W.HTM File:-

 <html>
 <head>
 <title></title>
 </head>
 <body bgcolor="cyan">document z<p>
 <a href=x.htm target=_self>Loads X.htm in its own window</a>
 </body>
 </html>


Loading a Document in the Top Window (_parent)

      The Y.HTM document shows how to load a document to the window immediately above that of the current Windows. Clicking on the y window link, the X.HTM document is loaded to the lower window, occupying its entire area.

Y.HTM File:-

 <html>
 <head>
 <title></title>
 </head>
 <body bgcolor="green">document y.htm<p>
 <a href=x.htm target=_parent>Loads X.htm in the top frameset (_parent)</a>
 </body>
 </html>

   The next figure shows the X.HTM file taking over the frame called trio, after the link of the Y document was pressed.



      Now you know all about the frame creation and manipulation features. Always remember to carefully plan the structure of your documents to avoid creating navigation problems between the frames.

👈Episode 13.2                                                                                                  Episode 14.1👉
Share This Post
PRINT THIS POST

No comments:

Post a Comment

If you have any doubts. Please let me know.

Featured post

*Episode 1* MCQ for Govt. Job/ Private Job/ MNCs

  Topic:- One Word Substitution 1) Especially skilled in storytelling  Answer:- Raconteur 2) Fear of loneliness Answer:- Eremophobia  3) Usa...