Ahmed Mostafa
Ahmed Mostafa

Reputation: 419

Detect/Prevent google chrome extensions of translating my web page using JavaScript

We have developed a simple WYSIWYG editor to allow users to modify their articles online, but we have faced with a problem that some users are using Chrome extensions to translate the text.

Could we detect/prevent this action using Javascript?

HTML modified/transelated by chrome extensions

I have used (<meta name="google" content="notranslate">) but it doesn't useful except with "Google-translate". So my issue is with other Google-extension/Google-Apps like "ImTranslator", which is able to inject HTML tags into my page

http://about.imtranslator.net/tutorials/presentations/imtranslator-for-chrome/ https://chrome.google.com/webstore/detail/imtranslator-translator-d/noaijdpnepcgjemiklgfkcfbkokogabh

enter image description here

Upvotes: 0

Views: 2579

Answers (2)

Daniel
Daniel

Reputation: 4735

You can mark up specific portions of your webpage and flag them as “don’t translate this part of the page!”. It’s supported by the web-based and browser-based tools from Yandex, Microsoft, Google, and Baidu.

<div translate="no" class="notranslate">
  […]
</div> 

Disabling translation tools may make your tools inaccessible/incomprehensible to some users. Try to only mark up the parts that really mustn’t be translated this way and leave as much as possible free to be translated.

Upvotes: 1

ReyAnthonyRenacia
ReyAnthonyRenacia

Reputation: 17651

I don't think this is within Javascript's control. Try adding this meta tag in your html file:

<html>
  <head>
    <meta charset="utf-8">
   .
   .
    <meta name="google" content="notranslate">
  <head>  

Meta tags that Google understands

When we recognize that the contents of a page are not in the language that the user is likely to want to read, we often provide a link to a translation in the search results. In general, this gives you the chance to provide your unique and compelling content to a much larger group of users. However, there may be situations where this is not desired. This meta tag tells Google that you don't want us to provide a translation for this page.

Upvotes: 2

Related Questions