Alternatives to AJAX CORS

I have a REST API service on api.example.com domain. And you want to use this api also for my javascript ajax Requests at www.example.com.

I create my jQuery AJAX requests (GET, POST, PUT and DELETE) using CORS, and everything works fine on firefox and chrome. I tested the script in Opera and did not load anything. After that, I read some online articles and should understand that CORS does not work with Opera.

What are the alternatives for receiving and transferring data to the recreation service? JSONp does not work because I need other HTTP verbs (POST, PUT, DELETE).

Create php-Script tunneling in the same domain? But the more I have more network traffic and server load.

Client -> WWW-Server -> API-Server
API-Server -> WWW-Server -> Client

instead

Client -> API-Server
API-Server -> Client

I am grateful for every Idea that will be transmitted to me.

+3
2

, YQL.

Yahoo! - , SQL, , -.

YQL API. :

Client -> YQL -> API Server

.

YQL . , :

  • IP-:/v1/public/: 2000 ; /v 1/yql/: 20 000 .

  • YQL 99,5%.

, , Yahoo! , , , , . , YQL ( ​​ - TipTheWb.org)

, , CORS YQL :

function browserSupportsCors() {
    if ("withCredentials" in new XMLHttpRequest())
        return true; // most browsers
    else if (typeof XDomainRequest == "object")
        return true; // IE8+
    else // Opera currently here, but they'll get better pretty soon :)
    return false;
}

jQuery, support .

if (!$.support.cors) {
    // YQL fallback
}

YQL.


Opera!

+3

- script .

, , - , .
- - , node.js, .

0

All Articles