J
J
js-newbie2020-03-01 14:43:50
JavaScript
js-newbie, 2020-03-01 14:43:50

Google Chrome/Google Translate not translating popups now?

Wrote JS code that opened a popup window and filled it with text. Until recently, desktop Google Chrome successfully translated the text in these pop-up windows by RMB > "Translate to Russian". And some time ago I stopped translating. This RMB menu item in pop-up windows has disappeared. And even when installing the official Google Translate browser extension, it doesn't translate either: when you click "Translate page", nothing happens. And in the console there are no errors, nothing, silence. Those. in the main windows there is a translation, but in the pop-up windows there is no translation. I can not understand: the ban on the translation of pop-up windows is a fundamental change that appeared in one of the latest versions of Chrome? Or is this a problem specifically with my pop-up windows and, accordingly, the code that generates them?

JS code to open a popup

JS-код, открывающий всплывающее окно:
let title = document.querySelector('head > title');
let text = document.querySelectorAll('p');
let text0 = '';
for (let text1 of text) {
    text0 = text0 + text1.outerHTML;
}
let button1 = document.createElement('button');
button1.innerHTML = 'Открыть текст в новом окне';
button1.onclick = function() {
    let text_window = window.open();
    text_window.document.title = 'Текст: ' + title.innerHTML;
    text_window.document.body.innerHTML = text0;
}
document.body.prepend(button1);
let button2 = document.createElement('button');
button2.innerHTML = 'Открыть текст в текущем окне';
button2.onclick = function() {
    document.head.innerHTML = title.outerHTML;
    document.body.innerHTML = text0;
}
button1.after(button2);

Чтобы разобраться, добавил button2 для переноса текста ровно в том же виде не в новое окно, а в текущее - здесь всё переводит, хоть ПКМ, хоть браузерным расширением. А в новом окне (button1) - не переводит.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2020-03-01
@dimonchik2013

PKM liked
Google here recently there was a topic "where did it go"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question