0

Google sends many people to my website using the translator. It is not needed. Therefore, when someone arrives, it looks like this:

http://translate.google.com/translate?hl=en&sl=de&u=http://stackoverflow.com

The site functions OK but not 100% like it should.

I would prefer to have an index.php (or HTML) file that is a redirect to the main URL. It should target and replace the entire window (removing any reference to Google Translate).

I tried different variations of the below but it did not work.

<META http-equiv="refresh" content="0;URL=http://www.domain.com" target="_new">

_parent and _top were tried.

Can you please help with this?

VMAtm
  • 27,943
  • 17
  • 79
  • 125
Osensnolf
  • 17
  • 5
  • (removing any reference to Google Translate) .. its legal? Read their terms of use? Use API instead of this. https://cloud.google.com/translate/v2/terms – daremachine Apr 09 '15 at 14:07
  • My website is already in English. That is the problem. My readers are in American and so is my Website. I want the Redirect to reload the page WITHOUT Google Translate. – Osensnolf Apr 09 '15 at 14:29
  • your site is being translated by non-English speakers, who doesn't understand your content. Try to define the language they use and make a localizible version. – VMAtm Apr 09 '15 at 15:12
  • Can someone please provide the code. Only people in the US visit my site because it is for companies in the USA. People are not translating it themselves. Google does it for them in the search result. – Osensnolf Apr 09 '15 at 15:21
  • For how to do it, combine @AlexanderB's answer below with http://stackoverflow.com/a/3193193/582278. Nonetheless, I have to agree with other commenters. Google doesn't send users to your site by Translator just for the fun of it. Either people think your site is not in English, or people want to read your site in a language other than English. Either way, they are trying to translate your site. There are lots of non-English speakers in the US, and it seems like you're going to do more harm than good to your website stats by trying to do this. – Dan Blows Apr 09 '15 at 15:29
  • I assure you people are not doing it manually. My site is in English. Google translate is trying to translate it from German to English for some people. No text is changed. The problem is that some scripts do not work and there are dictionary popups for some words. I will try the Alex's answer once I know the full text to use in my index.php file. Thank you for your help. – Osensnolf Apr 09 '15 at 15:38

3 Answers3

2

This should redirect to example.com if it accessed via iframe, which is how translator do it.

<script type="application/javascript">
    if (window.parent && window.parent !== window) {
        window.parent.location = '//example.com';
    }
</script>
AlexanderB
  • 879
  • 9
  • 12
  • Thank you for this. I have very little experience with javascript. What is the full code I will put in my index.php file or do I need to rename it to index.jsp? – Osensnolf Apr 09 '15 at 15:36
  • @Osensnolf, I edited the code so you can include it in you index file. You can place it right after tag. – AlexanderB Apr 09 '15 at 15:43
  • I tried but no success. This is what I used. I renamed index to .html and .php Title – Osensnolf Apr 09 '15 at 20:47
1

You can look up in the URL for an specific word (like google) to see if the path was altered and then do the redirect.

var site_url = window.location.href;

if (site_url.indexOf("google") > 1)
{
  window.location = "http://example.com";
}
Jordan Cortes
  • 271
  • 1
  • 2
  • 16
0
<script type="text/javascript">
if(window.parent&&window.parent!==window){
    window.parent.location='//example.com';
}
</script>

Paste it in your index page and run it!!!

Lakshman Kambam
  • 1,498
  • 13
  • 20