0

In SP2013, I have a master page (.html/.master) file that I want specific pages that use this master page to have the ability for devs to override a specific meta tag. Specifically this one

<meta http-equiv="X-UA-Compatible" content="IE=EDGE" />

By default it comes with

<meta http-equiv="X-UA-Compatible" content="IE=10" />

But is there a way I can wrap this or move this into an asp tag that I can then override at a page level or page layout level?

I see this in the .html master page file

    <!--MS:<SharePoint:AjaxDelta id="DeltaPlaceHolderAdditionalPageHead" Container="false" runat="server">-->
        <!--MS:<asp:ContentPlaceHolder id="PlaceHolderAdditionalPageHead" runat="server">-->
        <!--ME:</asp:ContentPlaceHolder>-->
        <!--MS:<SharePoint:DelegateControl runat="server" ControlId="AdditionalPageHead" AllowMultipleControls="true">-->
        <!--ME:</SharePoint:DelegateControl>-->
        <!--MS:<asp:ContentPlaceHolder id="PlaceHolderBodyAreaClass" runat="server">-->
        <!--ME:</asp:ContentPlaceHolder>-->
    <!--ME:</SharePoint:AjaxDelta>-->

Is there a way to put it into here, such that I can override it at a page level?

Thanks

1 Answer 1

0

Solution 1 Default value is produced by the <SharePoint:IECompatibleMetaTag runat="server" /> tag in the Master Page file (.master).

If you cannot change the master page, SharePoint allows us to add elements to head tag through

<asp:ContentPlaceHolder id="PlaceHolderAdditionalPageHead" runat="server">

Developers can add it in custom page layouts. This is an example:

<asp:ContentPlaceHolder id="PlaceHolderAdditionalPageHead" runat="server">
  <meta http-equiv="X-UA-Compatible" content="IE=Edge"/>
</asp:ContentPlaceHolder>

This code allows you to add your custom X-UA-Compatible value (and any other head element you want) to the page. The problem with this solution is that it cannot automatically remove default X-UA-Compatible tag. The browser behavior is not clear in case of multiple X-UA-Compatible meta tag in the page. In my experience, preferable solution is to define a custom master page (as a copy of current one) and change the meta tag value in this new master page.

Solution 2
Disclaimer: test this solution in a non-critical environment, backup any file you will change before you start the test.
If change the master page is not a problem, you can downlaod .html file of current master page from the Master Page Library in site settings. Then you edit this html file with any editor, removing this line

<!--SPM:<SharePoint:IECompatibleMetaTag runat="server"/>-->

and replacing it with X-UA-Compatible tag you need, save .html file, reupload the .html file to Master Page Library.
After upload completes SharePoint will recompile the .master file from your edited .html file. In this way you will have your X-UA-Compatible metatag value on every page that use that master page.

4
  • I have tried this but the problem is it adds a 2nd meta tag which then gets ignored. The first one cones from the master page (.html) outside of any asp tag
    – omega
    Jan 16, 2021 at 18:29
  • @omega If change the master page is not a problem, you can try with Solution 2 I have edited. Jan 16, 2021 at 21:00
  • Does this tag mean go to IE11?
    – omega
    Jan 16, 2021 at 21:56
  • @omega, in SP2013 <!--SPM:<SharePoint:IECompatibleMetaTag runat="server"/>--> produce a IE10 compatibility tag. I'm not able to find official docs on this, however it seems to use IE10 instead of IE11 (or Edge) in order to prevent visualization issues with SP2010 sites migrated to SP2013. Jan 17, 2021 at 9:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.