Stop browser from translating any code in the page.
Type javascript:
in the browser's url bar, paste the following code and press enter.
var q=document.querySelectorAll;var o={p:q('pre'),c:q('code'),h1:q('h1'),h2:q('h2'),h3:q('h3'),a:q('a')};for(i in o){o[i].forEach((e)=>{e.setAttribute('translate', 'no')})};
Open the devtools console, paste the following code and press enter.
const elements = {
preElements: document.querySelectorAll('pre'),
codeElements: document.querySelectorAll('code'),
h1Elements: document.querySelectorAll('h1'),
h2Elements: document.querySelectorAll('h2'),
h3Elements: document.querySelectorAll('h3'),
aElements: document.querySelectorAll('a')
}
for (element in elements) {
elements[element].forEach((el) => {
el.setAttribute('translate', 'no')
})
}
The code above selects all pre
, code
, h1
, h2
, h3
, and a
elements in the page and sets the translate
attribute to no
for each of them. This attribute tells the browser not to translate the content of the element.