There may be cases where you want to download the whole audio file before loading it into the HTML5 Audio widget.

In my case, while it is easy to just set the URL to the source of the HTML5 Audio widget, it does not work if the URL is cross-domain.

Downloading the whole binary was the only solution that I came up with.

This can be done using plain Javascript. With JQuery however, there seems to be no way to do this because AJAX calls return a response type of string. Using traditional Javascript is no problem anyway.

See following code:

That’s it!

HTML is a markup language so trying to look for ways to get values of query strings passed to the URL is not possible.

With Javascript however, it is. You can get the URL and its accompanying query string by using document.URL.

Now, to get the list of query strings and getting the value by key, we have to make our own custom function for this.

To get the value of a query string key, see the sample code.

When I started implementing Death By Captcha, I checked their documentation and some sample code so my coding will speed up once I get an idea how to use their service.

It is actually very simple but the sample code does not involve submitting captcha images in URLs. I did not want to save the captcha images then upload to them because that will take time.

If the captcha you are involved with has a first answer first serve situation, then you would be out of luck because saving the captcha image, uploading it and using Death By Captcha‘s service takes time.

Not that much, but even losing a few seconds is already big.

Their API does support submitting URL captcha images but the problem then is that if you get an incorrect answer, there is no way for you (or them) to know that the answer sent back to you was incorrect because they do not keep such history when it comes to image URLs.

Take this as a risk. If you really want to have some sort of history recorded whenever you use their service, then you are better of submitting physical files to them.

Anyway, in case you are interested with image URLs submitted rather than physical files, here is my class utility method that does just that.

Related Posts Plugin for WordPress, Blogger...