【问题标题】:Getting Cors Policy Error local host not able to run获取 Cors 策略错误本地主机无法运行
【发布时间】:2021-11-17 12:08:46
【问题描述】:

我在运行本地主机时收到此消息,因为我在 Net SuiteCommerce 高级电子商务网上商店工作,但从最近两天开始,我收到此错误。我在 Stackoverflow 和其他一些网站上搜索过它,但没有得到任何令人满意的解决方案,所以我将它发布在这里。

尝试下载 Cors 扩展并激活,但没有成功。除了谷歌浏览器之外,本地主机运行良好。

define(
    'JJRename.Rename.Rename'
,   [
        'Utils',
        'MenuTree.View',
        'Header.Menu.MyAccount.View',
        'JJRename.Rename.Rename.View'
    ]
,   function (
        Utils,
        MenuTreeView,
        HeaderMenuMyAccountView,
        RenameView
    )
{
    'use strict';

    return  {
        mountToApp: function mountToApp (container)
        {
            var layout = container.getComponent('Layout');

            _.extend(MenuTreeView.prototype,{
                getContext: _.wrap(MenuTreeView.prototype.getContext, function (fn){
                    var changeName = fn.apply(this, _.toArray(arguments).slice(1));
                    var array = changeName.menuItems;

                    _.each(changeName.menuItems, function (second){
                        _.each(second.children, function (children){
                            if(children.name == "Email Preferences"){
                                children.name = "Subscriptions"
                            }
                        });
                    });
                    return changeName;
                })
            });
            _.extend(HeaderMenuMyAccountView.prototype, {
                getContext: _.wrap(HeaderMenuMyAccountView.prototype.getContext, function (fn){
                    var helloWorld = fn.apply(this, _.toArray(arguments).slice(1));
                    console.log("first", helloWorld)
                    _.each(helloWorld.entries, function (first){
                        _.each(first.children, function (children){
                            if(children.name == "Email Preferences"){
                                children.name = "Subscriptions"
                            }
                        });
                    });
                    return helloWorld;
                })
            });
        }
    };
});
Access to XMLHttpRequest at 'http://localhost:7777/who/shopping' from origin 'http://www.cricketsca.ml' has been blocked by CORS policy: 

请求客户端不是安全上下文,资源位于更私密的地址空间local

shopping-local.ssp:1 从源“http://www”访问“http://localhost:7777/extensions/J_J/JJ_Base_Theme/3.0.2/img/favicon.ico”的资源.cricketsca.ml' 已被 CORS 策略阻止:请求客户端不是安全上下文,资源位于更私密的地址空间 local

【问题讨论】:

    标签: javascript node.js google-chrome cors suitecommerce


    【解决方案1】:

    可能是因为recent Google Chrome update。之前也有过类似的麻烦,但有一些work-arounds。现在您可以尝试其他浏览器(例如 Firefox)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-11-17
      • 2023-02-09
      • 2018-10-16
      • 2021-08-23
      • 2015-12-24
      • 1970-01-01
      • 2019-04-14
      • 1970-01-01
      相关资源
      最近更新 更多