Phantom Title tag


when we are working on refactoring and migration our old project to new one we found a problem with <title> tag .  when you look the page source of any page there was always a second empty title element in head tag.
Then we searched all contentplaceholders and client pages with loosing time but we didnt find out  why that phantom title tag comming from . After some code work we relized and find out our mistake in contentplaceholder which is defined in head tag in master page of site.

Here is the errors :
Validation (XHTML 1.0 Transitional): Element ‘title’ occurs too many times.

Here is the problematic codes

<head runat=”server”>
    <asp:ContentPlaceHolder ID=”head” runat=”server”>
        <title> Project Master </title>
    </asp:ContentPlaceHolder>
</head>

 we fix the problem using coding  like this:

<head runat=”server”>
    <title>
    <asp:ContentPlaceHolder ID=”ctpTitle” runat=”server”>
    </asp:ContentPlaceHolder>
    </title>
    <asp:ContentPlaceHolder ID=”head” runat=”server”>
       
    </asp:ContentPlaceHolder>
</head>

Advertisement

About bpostaci
Escalation Engineer in Microsoft.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: