title: Generate TinyURL with client side JavaScript--need CORS workaround
body: <p>I am building an small client-side application that is deployed on a website built with a WYSIWYG CMS. (Unfortunately, I do not have access to the server).</p>
  
  <p>I am saving the app's state in the URL with a hash-bang, and would like to shorten it using something like TinyURL's create API. Essentially, I would like to query a 3rd party service with my long URL as the request, and receive a response with a shortened one. </p>
  
  <p>My issue is that I don't know how to do this without recieving a CORS error message:
  <code>No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://www.site-im-working-on.com' is therefore not allowed access.</code></p>
  
  <p>Here is an example of what I have been trying to do (using jQuery): </p>
  
  <pre>
      var tinyAPI = 'http://tinyurl.com/api-create.php?url=';
  
      function getTinyURL () {
        var longURL = window.location.href;
        var request = tinyAPI + longURL;
  
        return $.get( request, function (response) {
          return response;
        });
      }
  
      // get tiny URL when on user action
      $('.share-button').on('click', function () {
        var tinyURL = tinyURL();
        // insert string into DOM element
        // copy string to user's clipboard
        // etc... 
      });
  </pre>
  
  <p>Is there any way to get around <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS" rel="nofollow">CORS</a> using only client-side code?</p>
  
  <p>(I am also open to using another URL shortener with a free API.)</p>