javascript - 添加嵌入式谷歌地图时console.log中的警告

标签 javascript html angular cookies websecurity

我想在我的网络应用程序中添加谷歌地图(嵌入式) map 。我正在构建一个 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

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

最佳答案

尝试以下操作:

您可以通过 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

关于javascript - 添加嵌入式谷歌地图时console.log中的警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58533744/

相关文章:

javascript - 如何 chop 结果标题?

javascript - D3、传递变量的 Angular 组件

angular - 为什么即使没有任何更改,我的 Angular2 模板的一小部分也会继续重新呈现?

javascript - 使用 javascript 和 canvas 没有在页面上绘制任何内容

php - DarkaOnline Swagger-php 生成错误的界面

ngFor 中的 Angular 动态 View 子级

javascript - iOS 上的 Devicemotion 事件

javascript - Eloquent JavaScript 第 7 章中的 critter.act 数组中的每个小动物是如何唯一的?

javascript - 无法打印特定的 div

css - 如何在 CSS 中将导航和内容区域的高度拉伸(stretch)到 100%?