How to add a meta tag above script tags

Hello! We are having a problem with IE9 crashing and not recognizing parameters passed into a script tag. We would like to add the meta tag

If I add this meta above all script tags inside the head tag manually on my web page, the problem goes away. However, when I add the tag to the CM1 template meta-data screen, even though I put the meta tag first, CM1 places the tag after the script tags. How can we get this meta tag added before all of the script tags? Thanks!

I guess the UI didn’t like the meta tag I entered. It isn’t showing up in the original post, so here it is (without the meta tag name).

http-equiv=“X-UA-Compatible” content=“IE=edge,chrome=1”

One more thing… We were able to solve this problem on CM System by adding the tag to the Velocity macro.

Tina,

Do you have a page you can point me to with that meta tag marked up in the source?

Also, when you need to paste html tags or markup in the community, wrap it with the ... tags to prevent it from getting cleaned up or stripped out.

Hi Daved,

An excerpt of the HTML from the page is below. Note that the meta tag is at the bottom, below the script tags.

If I manually move this tag above the script tags, then the problem goes away.

Thanks!


  
<title>Save and Make Money</title>   
<meta content="text/html; charset=UTF-8" http-equiv="content-type">   
<link rel="stylesheet" href="/web_resources/cm/css/perc_decoration.css" type="text/css" media="all">   
<link rel="stylesheet" href="/web_resources/cm/themes/smoothness/jquery-ui-1.8.9.custom.css" type="text/css" media="all">   
<link rel="stylesheet" href="/web_resources/themes/salt/layout.css" type="text/css" media="all">   
<script type="text/javascript" src="/web_resources/cm/jslib/jquery.js"></script>   
<script type="text/javascript" src="/web_resources/cm/jslib/jquery-ui.js"></script>   
<script type="text/javascript" src="/perc-common-ui/js/perc_common_ui.js"></script>   
<script type="text/javascript" src="/web_resources/cm/jslib/jquery.cookie.js"></script>   
<script type="text/javascript" src="/web_resources/cm/jslib/perc_membership.js"></script>   
<meta property="dcterms:type" content="page">   
<meta property="dcterms:source" content="Benefits-Section-Index ">   
<meta property="dcterms:created" datatype="xsd:dateTime" content="2012-07-18T10:24:18">  
<meta property="dcterms:alternative" content="Save and Make Money">   
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">   

Ahh, ok. I see you are forcing the browser, namely IE, to render the page in IE9 (for instance) as opposed to rendering in a compatibility mode.

In 2.7 you can edit the DocType declaration and you can insert extra tags into the head of the pages leveraging the “Additional Code” section, but you can’t force that code to be inserted at the beginning of the head.

My questions on this, though, is what behavior are you experiencing? And what mode is IE rendering the page in? Is it something where you need to set the DocType to HTML5 to avoid this issue?

We are having a problem with IE9 crashing and not recognizing parameters passed into a script tag, like

<script type="text/javascript" src="MyScript.js&gt;%7B" types> <br />



When the meta tag is not in the right place, the Types variable, for example, is null in MyScript.js. When the meta tag is in the right place, the data is passed.



To set the doctype to html5, are you suggesting I should try:

<br /> <!DOCTYPE html5 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <br />



for example?

And… are you also saying I can do this only in 2.7? We are using 2.6.0. As far as modes, I think it might be browser mode IE9 and document mode IE7.

Tina,

The doctype declaration for HTML5 is actually just:

To set the doctype to HTML5 in CM1 2.7, all you would have to do is open up the template, hit Edit Meta-Data, and there you will find a new radio option to change your doctype to HTML5.

Nathaniel

Oh, you’re using 2.6. No, I don’t believe there’s a way to change your doctype in 2.6.

Tina,

Is the browser crashing or is stuff just not loading on it? I notice in your script src that the script path was not closed with a quote and I just want to make sure I test the same scenario. I am able to keep the browsing loading properly but I get a blank page using what you have here.

I am just trying to determine if there is an alternative approach to adding the meta tag in to solve this for you.

Hello,
We are putting the meta info in the web.config file:

in <system.webserver> ... <br><br>
    <httpprotocol>
<br>
      <customheaders> <br>
        <clear></clear> <br>
        <add name="X-UA-Compatible" value="IE=edge,chrome=1"></add> <br>
      </customheaders> <br>
    </httpprotocol> <br><br>



This is working so far.</system.webserver>

Are you just using the Web.config file in the production site to add the header in?

This change has been made in our development site - not on the production site as of yet.