Cross Domain Ajax using CSSHttpRequest

CSSHttpRequest is cross-domain Ajax using CSS. Like JavaScript includes, this works because CSS is not subject to the same-origin policy that affects XMLHttpRequest. CSSHttpRequest functions similarly to JSONP, and is limited to making GET requests. Unlike JSONP, untrusted third-party JavaScript cannot execute in the context of the calling page.

        function(response) { alert(response); }

Data is encoded on the server into URI-encoded 2KB chunks and serialized into CSS rules with a modified data: URI scheme. The selector should be in the form#c<N>, where N is an integer index in [0,]. The response is decoded and returned to the callback function as a string:

    #c0 { background: url(data:,Hello%20World!); }
    #c1 { background: url(data:,I’m%20text%20encoded%20in%20CSS!); }
    #c2 { background: url(data:,I%20like%20arts%20and%20crafts.); }

CSSHttpRequest is open source under an Apache License (Version 2.0).

Requirements: IE6+, Firefox 2+, Safari 3+, iPhone
License: Apache License

By dbglory Posted in PHP

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s