Author

Topic: blockchain.info receive payments javascript buttons and IE (Read 762 times)

hero member
Activity: 737
Merit: 500
The blockchain.info payment buttons (http://blockchain.info/api/api_receive) are pretty sweet.  I am using them to accept donations on a free web app I run, but I ran into the fact that the buttons, as written, don't work in IE 8 and IE 9.  Now, in theory, I could have just decided to not care, but I hate to turn away the rare person who wants to give me a donation just because they might happen to be on an old crappy browser.

The issue appears to be that the pay-now-button.js code is making a cross domain ajax call using jQuery, but jQuery does not support CORS in Internet Explorer.

I fixed this for my website by using the jQuery plugin below.  Note, it works for IE8+ only, which is good enough for my app.  Also note, this only fixes the problem for web apps using SSL because IE refuses to do CORS to an SSL endpoint unless the host page is also SSL.

Plugin:  https://github.com/MoonScript/jQuery-ajaxTransport-XDomainRequest/blob/8754607e5f9ab73ccc37246f0c12fed14f85bd28/jQuery.XDomainRequest.js
SSL restriction: http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx

You might want to either recommend this plugin, or better yet change the pay-now-button.js code and API to support/use JSONP instead of CORS.
Jump to: