【问题标题】:Warning in console.log when adding embedded google maps添加嵌入式谷歌地图时console.log中的警告
【发布时间】:2020-02-20 08:15:02
【问题描述】:

我想在我的网络应用程序中添加谷歌地图(嵌入式)地图。我正在构建一个 Angular 8 并使用内置服务器,但仍在 console.log 中显示警告

A cookie associated with a cross-site resource at https://google.com/ was set without the `SameSite` attribute. A future release of Chrome will only deliver cookies with cross-site requests if they are set with `SameSite=None` and `Secure`. You can review coo...

我在 ngOnInit 方法的代码中所做的,我已经添加了这个

    this.cookieService.set('cross-site-cookie',"bar");
    this.cookieService.set('SameSite','SameSite=None; Secure');

上面的代码我使用了名为 ngx-cookie-service 的 npm 包。也因为我自己参考了这个网站

https://github.com/GoogleChromeLabs/samesite-examples/blob/master/javascript.md

我不确定我做对了还是错了。我所做的只是使用我所在位置的谷歌地图中的“复制链接”完全复制。如何解决这个问题。

【问题讨论】:

    标签: javascript html angular cookies websecurity


    【解决方案1】:

    尝试以下方法:

    您可以通过 chrome://flags Cookie Deprecation messages disabled 禁用它们。

    Chrome Console SameSite Cookie Attribute Warning

    如果您可以添加完整的谷歌地图,请遵循本教程:

    https://dev.to/devpato/setup-google-map-in-angular-app-the-pro-way-3m9p

    将谷歌地图添加到您的 Angular 应用程序的更简单方法: https://dev.to/devpato/setup-google-maps-with-agm-in-angular-app-33em

    【讨论】:

    • 感谢您的提示。我认为它适用于下面的 npm 安装。只是,它是免费的吗?我只想从网上打电话。以及如何启用查看更大的地图?
    • @AmirulIdzham 更新了答案。是的,它们是免费的 :)
    【解决方案2】:
    <iframe src="your google map url"></iframe>
    

    试试这个。

    【讨论】:

    • 对不起,先生,不工作。我从谷歌得到这个。但同样的结果
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-06-23
    • 1970-01-01
    • 2014-01-28
    • 2012-04-28
    相关资源
    最近更新 更多