Load external content using AJAX

后端 未结 2 877
无人及你
无人及你 2020-12-22 10:44

Is it possible to load an external site\'s content using jQuery\'s Ajax rather than an iFrame?

This is what I am trying to achieve, but it would seem there might be

相关标签:
2条回答
  • 2020-12-22 11:27

    It is possible, in part. You'll need to have your server act as a proxy:

    $('#result').load('fetch.php?s=http://www.google.com');
    // or something like that
    

    As for having the client load a page cross-domain, it won't (shouldn't) be possible.

    0 讨论(0)
  • 2020-12-22 11:27

    Is it possible to load an external site's content using jQuery's Ajax rather than an iFrame?

    The Same Origin Policy usually prevents it. You can work around it using JSON-P to transport that data.

    In flash you can put a cross-domain policy file in the root of the site allow certain sites to access the content of swf files or other files. Is this something that could be done using AJAX?

    Not cross-browser, the standard is too new (and unfinished)

    0 讨论(0)
提交回复
热议问题