在iframe中使用嵌入式声音云播放器时
<iframe width="100%" height="300" scrolling="no" frameborder="no" allow="autoplay" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/251273255&color=%23ff5500&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&show_teaser=true&visual=true"></iframe>
它储存曲奇。
如何在没有cookies的情况下嵌入声音云播放器?
注意:我已经尝试过<iframe ... sandbox>,甚至sandbox="allow-scripts",就像Recommended method to prevent any content inside iframe from setting cookies中建议的那样,但是播放器不起作用。
发布于 2021-11-16 13:18:49
<iframe sandbox="allow-same-origin allow-scripts allow-popups allow-forms" width="100%" height="300" scrolling="no" frameborder="no" allow="autoplay" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/251273255&color=%23ff5500&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&show_teaser=true&visual=true"></iframe>请试试这个sandbox="allow-same-origin allow-scripts allow-popups allow-forms"
发布于 2021-11-16 16:47:39
这个问题类似于:Disable Cookies Inside A Frame/Iframe
但这是您需要的代码:
<iframe sandbox="allow-scripts" src="//w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/251273255&color=%23ff5500&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&show_teaser=true&visual=true"></iframe>
此代码阻止cookie,并允许缓存和缓存不是cookie。虽然相似,但它们并不相同。以下是证明它只需要缓存而不需要cookie的证据。

https://stackoverflow.com/questions/69900288
复制相似问题