<bdo id='5tNdi'></bdo><ul id='5tNdi'></ul>

    1. <tfoot id='5tNdi'></tfoot>

      <small id='5tNdi'></small><noframes id='5tNdi'>

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

    3. 使用 .getJSON 获取 Play 商店应用详细信息时出现跨域阻止请求 [CORS] 错误

      时间:2024-05-10

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

            1. <small id='uj1jv'></small><noframes id='uj1jv'>

                本文介绍了使用 .getJSON 获取 Play 商店应用详细信息时出现跨域阻止请求 [CORS] 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                所以基本上我使用 42matters.com APP market API 从 google play 商店获取应用程序详细信息或信息,一切正常,我收到了 JSON 响应,但是当我周末假期后回到办公室时,这个相当奇怪的错误来了,没有返回任何东西.

                So basically i was using 42matters.com APP market API to get the app details or information from the google play store, everything was working fine and i was getting the JSON response back, but when i came back to office after weekend holidays, this rather strange error came and nothing was being returned.

                我使用过 $.getJSON 函数,例如:

                I have used $.getJSON function like:

                var packageID = 'com.whatsapp';
                   $.getJSON('https://42matters.com/api/1/apps/lookup.json?p='+packageID+'&access_token=accesstoken1234')
                .done(function(appDetails) {
                            $('#logo').html(JSON.stringify(appDetails));
                        });
                

                如前所述,这是返回数据,我能够相应地更改所有内容,但现在它无缘无故地给了我这个错误

                As mentioned this was returning the data and i was able to change everything accordingly but now it is giving me this error for no reason at all

                Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://42matters.com/api/1/apps/lookup.json?p=com.whatsapp&access_token=accesstoken1234. This can be fixed by moving the resource to the same domain or enabling CORS
                

                我已经使用 PHP 启用了 CORS,但没有发生任何事情,尝试更改 apache 的 conf 文件以在此处启用 CORS,但服务不会因此重新启动,所以我被卡住了.

                i have enabled the CORS using PHP, and nothing happended, tried to change the conf file of apache to enable CORS there but the service wont restart with this, so i am stuck.

                还有一件事,当我在浏览器中手动输入上述链接时,它确实给出了预期的结果.请帮我解决它

                One more thing, when i manually enter the above link in the browser, it does give the desired result. Please help me resolve it

                推荐答案

                CORS 在浏览器端被阻止,不允许 AJAX 从另一个域请求数据.您应该联系 42matters.com 团队为您打开 crossdomain.xml,像这样 CORS jQuery AJAX 请求 或 有人可以发布格式良好的 crossdomain.xml 示例吗?

                CORS is blocked in browser side that won't allow AJAX to request data from another domain. You should contact the 42matters.com team to open the crossdomain.xml for you like this CORS jQuery AJAX request or Can someone post a well formed crossdomain.xml sample?

                或者 AJAX 跨域的解决方法是 JSONP:jQuery AJAX 跨域 但是API 应该支持这种请求.

                Or the workaround for AJAX Cross-Domain is JSONP: jQuery AJAX cross domain but the API should support this kind of request.

                最后一点是不要使用AJAX从其他来源收集数据,如果是移动平台,它应该有原生的HTTP请求对象来做到这一点

                The last thing is don't use AJAX to collect data from another sources, if it is mobile platform, it should have native HTTP Request object to do this

                这篇关于使用 .getJSON 获取 Play 商店应用详细信息时出现跨域阻止请求 [CORS] 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:使用多个嵌套 JSON 键 (PHP) 进行 DynamoDB 扫描 下一篇:AMP 访问控制允许 Source Origin 标头问题

                相关文章

                <legend id='HAGuF'><style id='HAGuF'><dir id='HAGuF'><q id='HAGuF'></q></dir></style></legend>
              • <tfoot id='HAGuF'></tfoot>
                1. <small id='HAGuF'></small><noframes id='HAGuF'>

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