<audio autoplay="" src="http://translate.google.com/translate_tts?ie=utf-8&tl=en&q=hello%20world"></audio>
这在html中运行良好,但在gsp中不行。
反馈:
获取http://translate.google.com/translate_tts?ie=utf-8&tl=en&q=hello%20world 404(未找到)
好奇:如果我使用url(直接)一次,收到的mp3(来自谷歌)在缓存中,它的工作原理。
这也适用(在jsp中):
<iframe src="http://translate.google.com/translate_tts?ie=utf-8&tl=en&q=hello%20world"></iframe>
答案 0 :(得分:1)
Google阻止与referer(以及来自不受欢迎的用户代理)的呼叫。通过单击浏览器中的链接,您将发送引用。
不作品(没有引用者,cURL使用者):
curl -v 'http://translate.google.com/translate_tts?ie=utf-8&tl=en&q=hello%20world'
作品(没有参考):
curl -v -A 'Mozialla' 'http://translate.google.com/translate_tts?ie=utf-8&tl=en&q=hello%20world'
不作品:
curl -v -A 'Mozialla' -e 'www.stackoverflow.com' 'http://translate.google.com/translate_tts?ie=utf-8&tl=en&q=hello%20world'