search

Home  >  Q&A  >  body text

javascript - Please tell me how to embed the page content on the server in a local HTML page in a DIV? No need for iframe.

报错信息如下:XMLHttpRequest cannot load http://172.31.71.33/a/mobile/... No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:63343' is therefore not allowed access.

阿神阿神2701 days ago922

reply all(3)I'll reply

  • ringa_lee

    ringa_lee2017-07-05 10:42:37

    Needs cross-domain~~
    https://blog.codefun.cn/blog/...

    reply
    0
  • 怪我咯

    怪我咯2017-07-05 10:42:37

    The server you want to nest depends on whether you have permission.

    Just turn on access-Control-Allow-Origin

    Used PHP as an example

    header("Access-Control-Allow-Origin: *");

    reply
    0
  • 欧阳克

    欧阳克2017-07-05 10:42:37

    Provide several ideas:
    1) Back-end rendering
    2) Use

    <p id=showImport></p>
    <IE:Download ID="oDownload" STYLE="behavior:url(#default#download)" />
    <script>
    oDownload.startDownload('app.htm',onDownloadDone);
    
    function onDownloadDone(downDate)
    {
     document.all.showImport.innerHTML=downDate;
    }
    </script>

    Refer to the official website:
    https://msdn.microsoft.com/en...

    3) Use

    <object style="border:0px" type="text/x-scriptlet" data="import.htm" width=100% height=30></object>
    

    4)<link rel="import" href="myfile.html">
    Reference: https://developer.mozilla.org...

    reply
    0
  • Cancelreply