I'm trying to add the following tag
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
as the first one after <header>
in the output of rmkardown HTML document. This is necessary for Internet Explorer, as explained in this MSDN article.
This answer does not work for me because the tag is added at the end of <head>
and is ignored. My HTML output has some script embedded that is written before the X-UA-Compatible meta tag.
Is there a way to add the tag as the first one automatically in rmarkdown?
I just ran into this issue too. As people have said in the comments, editing the template html file used by rmarkdown works. I copied and edited the template saved at approximately "C:\Users\ProfileX\Documents\R\win-library\3.4\rmarkdown\rmd\h\default.html" (thanks @visu-l)
You want to add the tag as the first one within <head>
:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"$if(lang)$ lang="$lang$" xml:lang="$lang$"$endif$>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
Then save the html template, and point to it within YAML:
---
title: "xxx"
output:
html_document:
template: path/to/custom/template.html
---
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With