Do a search on google for “youtube api javascript upload” and you’ll get all kinds of results. There are a huge number of ways people try to get around the document same origin policy to make an HTTP request using JavaScript. Lets go through some of them:

You can create a real HTML form and submit it with JavaScript, and you can avoid the page refresh by submitting to an iframe. You can use jsonp to sneak by and load remote JavaScript using a script tag. You can fruitlessly attempt to muck with document.domain. There are all kinds of other crazy hacks people use to circumvent the same origin policy, but they are all either severely limited, or suffer in terms of your ability to control the HTTP request parameters and properly handle the response in failure scenarios.

Another option is to skip the whole idea of submitting your requests directly from the browser to the remote server. You can install your own proxy server on the same domain as your client JavaScript application and make requests to your proxy which then makes the disallowed requests for you because your proxy server isn’t governed by the same origin policy. This method gives you full control over the entire process, but setting up and maintaining a proxy server, paying for bandwidth and storage, and dealing with the added complexity might be too expensive and time consuming. It might also be totally unnecessary.

CORS is here to save the day. CORS has existed for a long time, but for some reason (maybe browser compatibility reasons), it hasn’t yet caught on in a big way. Many well-known APIs, including Google’s YouTube Data API v3 already support CORS. And chances are, the browser you’re currently using supports CORS too.

Continue reading »

I have two good options for internet service at my home in the Fresno High area: AT&T DSL which tops out at 1.5Mbits at my location or comcast which is much faster but can’t be unbundled from cable TV service which I don’t want and costs almost $80 / month. This is not attractive to a young professional like myself and doesn’t score the city any points when trying to attract other young professionals to the area.

This is why I was excited to see Google’s announcement today about offering its own internet service to interested municipalities. What’s more, they want residents and city officials to nominate their own communities to be among the first on Google’s rollout list. If we can get enough interest going, perhaps we can be one of the first cities on Google’s new internet service area plus it would get us some national attention and in a good way. Can we do it?

The service Google will be offering is 1Gb on an all-fiber network which is many hundreds of times more than my current service with AT&T. Lets force AT&T and Comcast into a real competition for once. I’m tired of crappy internet service and sometimes it makes me wish I lived elsewhere.

Continue reading »