Search code examples
javascripthtmlhttpgoogle-chrometext-to-speech

Hide referral information from JavaScript


I would like to use Google Translate TTS engine from my JavaScript code. It doesn't offer a public API, so it's difficult to use this very good service. I have written the following code, which runs perfectly in static html files in my desktop, but not in my web server.

var url = "http://translate.google.com/translate_tts?ie=UTF-8&q=" + encodeURIComponent(txt) + "&tl=es&total=1&idx=0prev=input";
var snd = new Audio(url);
snd.load();
snd.play();

I know the problem is that Google see the referral info and ignore me, because if I run Chrome with --no-referral argument, everything runs well and it sounds, even from my web server.

So my question is how to hide my referral info from JavaScript code, in order to avoid the need of running browsers with extra arguments. I need that Google doesn't know who I am.

Thank you.


Solution

  • You can't because of security reasons. There are TTS api's available just not free... Plus Google added this filter because of the people who start using it as an API...