Skip to main content
Inspiring
January 11, 2023
Answered

Display title of page in a child frame in web browser tab

  • January 11, 2023
  • 1 reply
  • 167 views

Our ColdFusion application is based on a page with all the menu options that calls the selected pages within a frame.

How can we display details of the page called in the browser tab : the standard <title> tag is not shown (as it is within a frame).

Ideally display the title, but the URL or any other unique identifying value will do.

 

Code extracts : 

In the Frame called “main” we initially show the welcome page, and when the relevant menu button is clicked, the Java script  function replaces the contents of the “main” frame with the new page.

 

<FRAMESET …>

                <FRAME SRC="../menuContents.cfm" NAME="Contents" … >

                <FRAME SRC="../welcome.cfm" NAME="main" …>

</FRAMESET><noframes></noframes>

 

<td><input name="image" type="image" onClick="power('xxx.cfm')" value="Nominal" src="../images/xxx.gif" …></td>

 

<script language="javascript">

function power(newPage){

parent.frames["main"].location = newPage; // instructs which frame to change...

}

    This topic has been closed for replies.
    Correct answer paul_durrant

    Found a way to do this using Java Script : window.parent.document.title

    Downside is you need to reset it for every page, otherwise it just carries the last value over to the next page.

    Java Script

    function power(href_in, setTitle){

                    parent.frames["main"].location = href_in; // instructs which frame to change...  

                    window.parent.document.title = setTitle;

    }

    function setTitle(href_in){

                    window.parent.document.title = href_in;

    }

     

    ColdFusion

    page call #1 : onClick="power('xxx.cfm','Test1')"

    page call #2 : href="yyy.cfm" … onClick="setTitle('Test2')"

    1 reply

    paul_durrantAuthorCorrect answer
    Inspiring
    January 13, 2023

    Found a way to do this using Java Script : window.parent.document.title

    Downside is you need to reset it for every page, otherwise it just carries the last value over to the next page.

    Java Script

    function power(href_in, setTitle){

                    parent.frames["main"].location = href_in; // instructs which frame to change...  

                    window.parent.document.title = setTitle;

    }

    function setTitle(href_in){

                    window.parent.document.title = href_in;

    }

     

    ColdFusion

    page call #1 : onClick="power('xxx.cfm','Test1')"

    page call #2 : href="yyy.cfm" … onClick="setTitle('Test2')"