AJAX cross domain call

前端 未结 11 1094
温柔的废话
温柔的废话 2020-11-22 03:43

I know about AJAX cross-domain policy. So I can\'t just call \"http://www.google.com\" over a ajax HTTP request and display the results somewhere on my site.

I tried

11条回答
  •  不知归路
    2020-11-22 04:14

    You can use the technology CORS to configure both servers (the server where the Javascript is running and the external API server)

    https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS

    p.s.: the answer https://stackoverflow.com/a/37384641/6505594 is also suggesting this approach, and it's opening the external API server to everyone else to call it.

提交回复
热议问题