Skip to main content
Known Participant
April 15, 2013
Answered

CF adding extra <html>, <head>, and <body> tags to pages

  • April 15, 2013
  • 1 reply
  • 699 views

I have been having issues with my titles not showing up on my CF pages. I finally looked at the page source in the browser and found that CF is inserting extra <html>, <head> and <body> tags at the beginning of the pages. (see samples below). I'm pretty sure it is the CF engine that is doing this because I took a cfm page and just changed the extension to html and everything worked fine (except the CF code). There weren't any extra tags inserted and the titles was displayed. I also noticed that the CF engine appears to be adding the very first line <!DOCTYPE HTML ...>

Does anyone know why this might be happening?

Thanks

David

CF Page - notice extra tags in red

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">


<html>

<head>

<title>Untitled</title>

</head>


<body>



</body>

</html>

<html>

<head>


<style type="text/css">

<!--


BODY
{
font-weight: normal;
font-size: 10pt;
font-family: Arial;
background-color: white;
text-decoration: none
}


Same page with extension changed to html - code is a bit different because style sheet didn't load because it uses cfinclude

<html>

<head>


<cfinclude template="fdp_style_sheet.html">


<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<title>Login</title>


<script type="text/javascript">

if($_SERVER["HTTPS"] != "on")
{
    header("Location: https://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]);
    exit();
}
</script>


<script language="JavaScript" src="webbug.js"></script>

</head>


<body onload="writeBug();" marginheight="0" marginwidth="0">

    This topic has been closed for replies.
    Correct answer pete_freitag

    Take a look at your Application.cfm or Application.cfc file you probably have that code in there (Application.cfc/cfm runs first on every page request)

    1 reply

    pete_freitag
    pete_freitagCorrect answer
    Participating Frequently
    April 15, 2013

    Take a look at your Application.cfm or Application.cfc file you probably have that code in there (Application.cfc/cfm runs first on every page request)

    dwright65Author
    Known Participant
    April 15, 2013

    Peter,

    That was it.

    Thanks!

    DW