change the title tag of a web page dynamically?

Posted on 2007-07-30
Last Modified: 2008-01-09
Hi Experts,

How can I change the Title tag of a web page dynamically using server side code?

Also I was trying to do it using javaScript from within a frame i.e. parent.document.title = 'bla'. But I was inside a user control.

How can I call a javaScript function when my user control is finished loading?

thanks a lot
Question by:kateL
    LVL 7

    Expert Comment

    When a page loads you can change the title like page.title = "My new title"

    Author Comment

    Hmmm but not do I set the title when I am inside a user control that is a part of a web page that is in a frame?

    It's really the web page that contains the frames who's title I want to change
    LVL 2

    Accepted Solution

    You want the frame to control the frameset's <title> tag?  Be sure that your <head> is <head runat="server"> on the frameset page and then you should be able to do:

    Page.Title = "Your Page Title";

    If you want to control the <title> in the frameset page, you could use JavaScript.  Unless you need it hard-coded for SEO purposes.  The way you would do that is in your <head> section of your frame page you could put:

    <script type="text/javascript">
    parent.document.title = document.title;

    For example, without using ASP.NET, you could do it simply using JavaScript:
    <title>Change the Title here!</title>
    <script type="text/javascript">
    parent.document.title = document.title;


    <TITLE>This is a frameset, the title will be replaced.</TITLE>
        <FRAME src="frame.html"  />

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
    Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now