IE 7 and 8 Website Translator script fails with Javascript Error: hasOwnProperty in element.js

559 views
Skip to first unread message

bgx

unread,
May 18, 2015, 8:15:34 AM5/18/15
to google-tra...@googlegroups.com
Hi,

we use the website translator dropdown on several web sites. We noticed a few days ago that initializing the dropdown shows JavaScript errors on IE 7 and IE 8.

The exact source of the error is in line to of the file returned as  http://translate.google.com/translate_a/element.js where it says a.hasOwnProperty(b[c])?

The exact error is "Object doesn't support property or method 'hasOwnProperty'".

Strangely on one of our websites the translator dropdown does simply not show, on another one a JavaScript error is shown with every page load.

Any suggestions how to:
  • Make this work for IE 7 and 8 again?
  • At least avoid the JavaScript error being shown?

Thanks


Jesse Scherer (Google Cloud Support)

unread,
May 19, 2015, 6:13:01 PM5/19/15
to google-tra...@googlegroups.com
Greetings, and sorry to hear you're having trouble. I'm on the Cloud Support team. We support the Translate API, which is closely related to what you're using. A few points:

I'm not the authority on your problem: the problem you're having is with the website translator utility which we know a bit less about. I've sent a ping to an expert to see if they have any ideas. 

You're in the right place. It's totally fine that you asked here; both the Website Translator and API point to this forum as a source of help, regardless of the name.

Regarding other sources of help: I notice you cross-posted to Stack Overflow at http://stackoverflow.com/questions/30304600/ie-7-and-8-google-website-translator-fails-with-error-hasownproperty-in-element That is a great idea too! Our docs do not advertise that option very well (something I'll fix,) but since the same folks from Support monitor both this forum and the Stack Overflow google-translate tag it's a great option especially when you have a specific problem like this.

Now, to your issue itself :-) I'm curious as to why you're using IE7 and IE8. A check of Microsoft's website shows these versions to be unsupported except on some Windows Embedded versions, so the usual advice would be to update IE. That said, if you must use these versions for some reason, the folks on StackOverflow will be a great resource in figuring out how to work around this problem. I don't know your details, and none of these might help, but this very issue has come up before:

Dave Rensin (Google Cloud Support)

unread,
May 19, 2015, 6:45:28 PM5/19/15
to google-tra...@googlegroups.com
Any easy to try is to click on the Compatibility Mode icon in the URL bar. That often (though not always) fixes things.

-dave

bgx

unread,
May 20, 2015, 5:05:58 AM5/20/15
to google-tra...@googlegroups.com
Thanks guys,

Yes I cross posted because on second thought I wasn't sure if this is the right forum.

Re IE 7 and IE 8: We officially require IE 9+ for our website, but we know from stats that almost a quarter of our user base is still on IE 7 and 8.

FYI the problem also existed in compatibility mode on IE 9+ or in a .NET Web Browser control, embedded in another program, which defaults to IE 7.

To deal with the issue we now
  • don't show the translate utility for IE 7 and 8, users have to upgrade to get the translate option.
  • used <meta http-equiv="X-UA-Compatible" content="IE=edge" /> to force IE to use the latest document mode in compatibility view or a .NET Web Browser control.
The remaining issue is that the translation utility is still not working in an embedded Web Browser on a computer that has IE 10 or IE 11 installed (IE 9 seems to work). Yesterday, we got an invalid parameter error in another js file (which I managed to trap by wrapping the initialisation in a try/catch block as shown below), today it just seems to fail silently (maybe the error is trapped internally now?). This stabilises the situation, but we really would have liked to us the utility in the embedded browsers...


function googleTranslateElementInit() {
   
try {
       
new google.translate.TranslateElement({ pageLanguage: 'en', layout: google.translate.TranslateElement.InlineLayout.HORIZONTAL, gaTrack: true, gaId: 'UA-xxxxxxxx-x' }, 'google_translate_element');
   
}
   
catch(ex) {
       
//ignore
   
}
}


BTW: I got the error regardless whether I include the analytics parameters or not...

Thanks.

bgx

unread,
May 20, 2015, 5:09:10 AM5/20/15
to google-tra...@googlegroups.com
Forgot to emphasize: this was up and running for weeks. The issues must have been introduced with changes on the Google side of things a little while ago...
Reply all
Reply to author
Forward
0 new messages