Put meta tag on top of header section in typo3
Asked Answered
F

2

10

In order to prevent quirks mode in IE9 I need to add this lines at the very top of every HTML page:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />

Unfortunately typo3 moves the <meta http-equiv ... line to the end of the header section, making it useless.

How can I tell tyop3 to place the meta tag entry immeditely after the header tag?

Forging answered 29/5, 2012 at 10:18 Comment(3)
Why is it important that this is the first entry? Does it make a difference? If yes, it's a TYPO3 bug.Dotation
In some cases you have to tell IE 9 that it has not to fall back into quirks mode. This can be done with the mentioned meta tag. But it works only if it is listed before any script or css inclusion in the PHP header.Forging
Okay.. do you have a reference for this statement? If yes, I would file a TYPO3 bug and give it a try to fix it.Dotation
C
9

You can write the whole header by yourself, by adding disableAllHeaderCode = 1 to your typoscript or you can hack it by adding your meta tag directly to the head tag: page.headTag = <head><meta http-equiv="X-UA-Compatible" content="IE=edge" />

Covell answered 30/5, 2012 at 10:42 Comment(4)
page.headTag is definitely the way to go here!Fulgurating
it seems that @Sultanos had a better solution for newer versions of TYPO3 in his answer below.Covell
No, the 'meta.' notation does not work! The X-UA-Compatible Tag has to be the very first tag after the head tag, otherwise IE won't recognize it.Fulgurating
Yes, that's also the the solution that has worked best for me. Some more information: docs.typo3.org/typo3cms/TyposcriptReference/Setup/Page/… unfortunately Typo3 does not have the best documentation...Itu
L
-1

Place this at your typoscript

meta.X-UA-Compatible = IE=edge,chrome=1
Lhasa answered 16/7, 2013 at 12:9 Comment(1)
This does not help. X-UA-Compatible must be the very first tag in the head section. AFAIK only the title tag is allowed before it. Using page.meta creates a lot of markup in front of the X-UA and makes it useless.Lipocaic

© 2022 - 2024 — McMap. All rights reserved.