There is something very important in this thread that has been affected, but not fully explained. The HTML approach (adding a meta tag to the head) works sequentially on raw HTML pages or on very simple servers. My site is a very complex server site with main pages, themes and many third-party controls, etc. I found that some of these controls programmatically added their own tags to the final HTML that were clicked on the browser at the beginning of the title tag. It effectively rendered HTML meta tags to no avail.
Well, if you cannot defeat them, join them. The only solution that worked for me was to do the same in the event of pre-rendering my master pages as such:
Private Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender Dim MetaTag As HtmlMeta = New HtmlMeta() MetaTag.Attributes("http-equiv") = "Content-Type" MetaTag.Attributes("content") = "text/html; charset=utf-8;" Page.Header.Controls.AddAt(0, MetaTag) MetaTag = New HtmlMeta() MetaTag.Attributes("http-equiv") = "X-UA-Compatible" MetaTag.Attributes("content") = "IE=9,chrome=1" Page.Header.Controls.AddAt(0, MetaTag) End Sub
This is VB.NET, but the same approach will work for any server technology. For now, make sure that this is the last thing done before the page is displayed.
David Esquivel Aug 20 '13 at 18:39 2013-08-20 18:39
source share