title: Trying to call google translator api from Javascript code, getting 403 error
body: <p>I want to build a simple website in Javascript which when loaded, prints &quot;hello&quot; in Chinese language.</p>
  <p>For this,I was trying to use google translator call, like below :</p>
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang=&quot;en&quot;&gt;
  &lt;head&gt;
  &lt;meta charset=&quot;utf-8&quot;&gt;
  &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;&gt;
  &lt;!-- bootstrap.min.css + some js related files --&gt;
  
  &lt;body onload=&quot;myFunction()&quot;&gt;
  &lt;/body&gt;
      &lt;/head&gt;
      
      &lt;script&gt;
      
          function myFunction()
          {
              //alert(&quot;hello&quot;);
  
              var ourRequest = new XMLHttpRequest();
          var API;
          API = 'https://translate.google.co.in/?sl=auto&amp;tl=zh-CN&amp;text=hello&amp;op=translate';   
          
          //alert(API);
          ourRequest.onreadystatechange = function() 
              {
                      if (this.readyState == 4 &amp;&amp; this.status == 200)
                           {
  alert(ourRequest.responseText);                     
                          }
              };
          ourRequest.open('GET', API,false);
          ourRequest.send();
              
              
          }
      
      &lt;/script&gt;  
      
      
  &lt;/html&gt;
      
  </code></pre>
  <p>When I try to run this, I get the below error :</p>
  <p>try.html:43 GET <a href="https://translate.google.co.in/?sl=auto&amp;tl=zh-CN&amp;text=hello&amp;op=translate" rel="nofollow noreferrer">https://translate.google.co.in/?sl=auto&amp;tl=zh-CN&amp;text=hello&amp;op=translate</a> 403</p>
  <p>Seems google server rejected my call .
  Can someone please help me to fix this.</p>
  <p>Regards</p>