What prevents me from using $.ajax to load another domain's html?

前端 未结 4 1400
遇见更好的自我
遇见更好的自我 2020-12-17 06:31

My domain:

  


scrape


        
4条回答
  •  天命终不由人
    2020-12-17 07:12

    There are Four ways to get around Same Origin Policy

    1. Proxy - You request it from your server, your server requests it from other domain, your server returns it to the browser
    2. Flash cross domain policy - other domain must add a crossdomain.xml file to their site
    3. Cross domain HTTP header - other domain must add an Access-Control-Allow-Origin header to their page
    4. JSONP - It's a json web service that provides a callback function. Other domain must implement this.

    Note: The ONLY way to do it without the other domain's help is #1, routing it through your own server.

提交回复
热议问题