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?
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);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With