Reputation: 3160
Consider this snippet:
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]—>
I have access to the Page
object. So I can do something like this:
Page.Header.Controls.Add(new HtmlGenericControl())
How am I able to insert the above snippet to the ASP.NET Page's Header or Body?
Upvotes: 3
Views: 373
Reputation: 1154
This seems hacky and there's probably a nicer solution, but this seems to work:
protected void Page_Load(object sender, EventArgs e)
{
Literal comment = new Literal();
comment.Text = @"<!--[if lt IE 9]><script src='//html5shiv.googlecode.com/svn/trunk/html5.js'></script><![endif]-->";
Page.Header.Controls.Add(comment);
}
Upvotes: 3