<i id='DWUJk'><tr id='DWUJk'><dt id='DWUJk'><q id='DWUJk'><span id='DWUJk'><b id='DWUJk'><form id='DWUJk'><ins id='DWUJk'></ins><ul id='DWUJk'></ul><sub id='DWUJk'></sub></form><legend id='DWUJk'></legend><bdo id='DWUJk'><pre id='DWUJk'><center id='DWUJk'></center></pre></bdo></b><th id='DWUJk'></th></span></q></dt></tr></i><div id='DWUJk'><tfoot id='DWUJk'></tfoot><dl id='DWUJk'><fieldset id='DWUJk'></fieldset></dl></div>
    1. <legend id='DWUJk'><style id='DWUJk'><dir id='DWUJk'><q id='DWUJk'></q></dir></style></legend>

      <small id='DWUJk'></small><noframes id='DWUJk'>

      1. <tfoot id='DWUJk'></tfoot>
          <bdo id='DWUJk'></bdo><ul id='DWUJk'></ul>
      2. 我可以在与从该端口加载的脚本文件不同的端口上使用 XMLHttpRequest 吗?

        时间:2023-05-16

          <tbody id='9Q0JA'></tbody>

            <bdo id='9Q0JA'></bdo><ul id='9Q0JA'></ul>
            <tfoot id='9Q0JA'></tfoot>
            <i id='9Q0JA'><tr id='9Q0JA'><dt id='9Q0JA'><q id='9Q0JA'><span id='9Q0JA'><b id='9Q0JA'><form id='9Q0JA'><ins id='9Q0JA'></ins><ul id='9Q0JA'></ul><sub id='9Q0JA'></sub></form><legend id='9Q0JA'></legend><bdo id='9Q0JA'><pre id='9Q0JA'><center id='9Q0JA'></center></pre></bdo></b><th id='9Q0JA'></th></span></q></dt></tr></i><div id='9Q0JA'><tfoot id='9Q0JA'></tfoot><dl id='9Q0JA'><fieldset id='9Q0JA'></fieldset></dl></div>
            1. <small id='9Q0JA'></small><noframes id='9Q0JA'>

              <legend id='9Q0JA'><style id='9Q0JA'><dir id='9Q0JA'><q id='9Q0JA'></q></dir></style></legend>
                1. 本文介绍了我可以在与从该端口加载的脚本文件不同的端口上使用 XMLHttpRequest 吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我有使用 XMLHttpRequest(实际上是 jQuery)的网站.我还在同一台服务器上运行了另一个站点,该站点提供一个脚本文件,该脚本文件将 XHR 请求返回到该站点,即.

                  I have website that use XMLHttpRequest (jQuery, actually). I also have another site running on the same server, which serves a script file that makes XHR requests back to THAT site, ie.

                  http://mysite:50000/index.html包括

                  http://mysite:50000/index.html includes

                  <script src="http://mysite:9000/otherscript.js"></script>
                  

                  并且http://mysite:9000/otherscript.js包括

                  and http://mysite:9000/otherscript.js includes

                  $.ajax({
                      url: 'http://mysite:9000/ajax/stuff'
                  });
                  

                  问题是 - 这不起作用.来自加载脚本的 AJAX 请求只是失败,没有错误消息.据我所知,这是旧的同源政策.鉴于我控制了这两个站点,我能做些什么来完成这项工作吗?document.domain"技巧似乎对 XMLHttpRequest 没有任何作用.

                  The problem is - this doesn't work. The AJAX requests from the loaded script simply fail with no error message. From what I've been able to find this is the old same origin policy. Given that I control both sites, is there anything I can do to make this work? The "document.domain" trick doesn't seem to do a thing for XMLHttpRequest.

                  推荐答案

                  不,XHR 无法做到这一点.同域策略非常严格——相同的主机、相同的端口、相同的协议.对不起!您必须借助其他技巧(iframe、标题操作等)才能使其正常工作.

                  Nope- can't do this with XHR. Same-domain policy is very restrictive there- same host, same port, same protocol. Sorry! You'll have to resort to other tricks (iframes, title manipulation, etc) to get it to work.

                  这篇关于我可以在与从该端口加载的脚本文件不同的端口上使用 XMLHttpRequest 吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:在 XDomainRequest 或 ActiveXObject('Microsoft.XMLHTTP' 下一篇:为什么这个 jQuery AJAX PUT 可以在 Chrome 中工作,但不能在 FF 中工作

                  相关文章

                2. <small id='vMyR3'></small><noframes id='vMyR3'>

                3. <tfoot id='vMyR3'></tfoot>

                4. <i id='vMyR3'><tr id='vMyR3'><dt id='vMyR3'><q id='vMyR3'><span id='vMyR3'><b id='vMyR3'><form id='vMyR3'><ins id='vMyR3'></ins><ul id='vMyR3'></ul><sub id='vMyR3'></sub></form><legend id='vMyR3'></legend><bdo id='vMyR3'><pre id='vMyR3'><center id='vMyR3'></center></pre></bdo></b><th id='vMyR3'></th></span></q></dt></tr></i><div id='vMyR3'><tfoot id='vMyR3'></tfoot><dl id='vMyR3'><fieldset id='vMyR3'></fieldset></dl></div>

                  1. <legend id='vMyR3'><style id='vMyR3'><dir id='vMyR3'><q id='vMyR3'></q></dir></style></legend>
                      <bdo id='vMyR3'></bdo><ul id='vMyR3'></ul>