Add language attribute to header


I have a com site, which is actually only for norweigan users. How can I add the lang=“no” attribute to the header of this domains pages?
I can’t seem to get it working with either:
document.documentElement.setAttribute(“lang”, “no”);
or as
$(“html”).attr(“lang”, “no”);
Can you provide any help or guidelines for setting the language in the global scripts?
Best regards


I want to know as well


Hi guys, 

Here is a piece of JS that should help you (set the placement to “Head”):

&nbsp; <br />document.getElementsByTagName("html")[0].setAttribute("lang", "no");<br />



Hi Hristian - thanks a lot for your reply.
Unfortunately it didn’t help. I went to the script manager to place it in the head script for all main pages for the domain. The script is placed in the header, but seem not to work.
Best regards


Hi Lars, 

This is strange since the script works when I test it. 

Here are a couple of screenshots of a test page I set up (Chrome & Firefox). Chrome even detects that the language is set to “no” and asks if you want to translate it. 



Hi, is anybody managed to do that with the code shared by Hristian?
I put it in the header and republish my page, but I still can’t see the language tag in my Header.


Declaring lang attribute inside HTML tag

Hi @tunedglobal,

My script above got broken when Unbounce switched the community platforms last year.

Here is the script you need to use.

Here you can see it working on a demo page.



Thanks Hristian, it works!