我想在我的网络应用程序中添加谷歌地图(嵌入式) 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/