4

I have several Content Pages using the same Master Page, that don't all need the same javascript and css files included in the <head> tag.

Is it possible to change the contents of the <head> tag from the Content Pages?

aranasaurus
  • 345
  • 1
  • 3
  • 13

2 Answers2

3

it is, but I recommend doing it a bit different. I place a content place holder right above the close body tag. Then I populate the required JS scripts per content page. This will allow you to place the scripts at the bottom, but you could also do the same with the placeholder in the header.

You can also do so programmatically:

HtmlGenericControl js = new HtmlGenericControl("script");
js.Attributes["type"] = "text/javascript";
js.Attributes["src"] = "jscript/jquery.js";
Page.Header.Controls.Add(js);
Dustin Laine
  • 37,935
  • 10
  • 86
  • 125
  • I use a Content Placeholder in my head and at the end of my body to load scripts from my aspx pages. Works great! 1up! – Eric Bishard Mar 03 '15 at 02:25
0

Put a Placeholder control in the head and you should be able to use that in the content pages.

µBio
  • 10,668
  • 6
  • 38
  • 56