Adding code just before the <body>

Dcode warner asked on December 2, 2019 18:20

Is it possible to add a script or tag just before the opening on the

Recent Answers


Brenden Kehren answered on December 2, 2019 20:47

Yes. In your master template (portal I'm assuming), you add a HEAD HTML webpart at the very bottom of the page template. They are loaded in order so if this is at the bottom of the page, it will be the last one loaded before the closing </head> tag.

1 votesVote for this answer Mark as a Correct answer

Dcode warner answered on December 10, 2019 23:02

@brendenKehren Sorry Brenden. My question wasn't formatted very well. What i'm looking for is foe example:

<head>
</head>
<body>
<!--place script tag here directly after the body tag. The first tag after the body-->
 <form method="post" action="/" id="form"> 
</body>

In k7 it looks like this:
<body class="LTR Gecko Gecko71 ENUS ContentBody" >
<form method="post" action="/" id="form"> 
0 votesVote for this answer Mark as a Correct answer

Bernou Wagenaar answered on December 29, 2019 18:26

You can do that on a master page (page with master template). See documentation

So in the Pages application, go to a master page. It should have a "Master page" tab. On this tab there is an editable area right after the opening body tag.

0 votesVote for this answer Mark as a Correct answer

Dcode warner answered on January 20, 2020 22:22

@Bernou Wagenaar Can we do this for Kentico 7? Is it possible?

0 votesVote for this answer Mark as a Correct answer

Bernou Wagenaar answered on January 21, 2020 10:10

@Dcode warner Sorry, I don't have experience with Kentico 7.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.