How to add anything in <head> through jquery/javascript?

Viewed 268765

I'm working with a CMS, which prevents editing HTML source for <head> element.

For example I want to add the following above the <title> tag:

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
8 Answers

You can select it and add to it as normal:

$('head').append('<link />');

jQuery

$('head').append( ... );

JavaScript:

document.getElementsByTagName('head')[0].appendChild( ... );
Related