Javascript – Google Translate Not working in Any IE but works in Firefox and GoogleChrome

google-translator-toolkithtmlinternet-explorerjavascriptxmlhttprequest

I have tested this page in IE, Firefox, and Google Chrome. It works in all except IE. Can someone please tell me how to fix this, I have tried just about everything I could for the last two days.

TRY THIS TEST PAGE

<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
</head>

<body>
Hello
<div id="google_translate_element"></div>
        <script type="text/javascript">
        function googleTranslateElementInit() {
                new google.translate.TranslateElement({pageLanguage: 'en', layout: google.translate.TranslateElement.InlineLayout.SIMPLE}, 'google_translate_element');
            }
        </script>
        <script type="text/javascript" src="http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
</body>
</html>

When selecting a language it shows the choice picked but never completes the translation.. But works in FireFox and Google Chrome. IE just sits at 0% and just keeps spinning. Is anyone else experiencing the same issue?

The error it throws in the console when switching languages is this:

XMLHttpRequest: Network Error 0x2f1c, Could not complete the operation due to error 00002f1c.

enter image description here

enter image description here

enter image description here

I have tried many things even going as far as something like this:

<div id="google_translate_element"></div>
        <script type="text/javascript">
        $.ajax({
  url:"http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit",
  type:"POST",
  data:"google_translate_element",
  contentType:"application/json; charset=utf-8",
  dataType:"json",
  success: function googleTranslateElementInit() {
                new google.translate.TranslateElement({pageLanguage: 'en', layout: google.translate.TranslateElement.InlineLayout.SIMPLE}, 'google_translate_element');
            }

  })
        </script>

Please any help would be greatly appreciated!!

Best Solution

In the code there is a link to the google translate file

//translate.google.com...

When I put the full address into my browser it automatically downloaded a text file. I converted the .txt file into to a .js file then replaced the web link with a link to the js file and it worked fine. I hope this helps.

Related Question