YouTube 现在要求嵌入视频 iframes 使用 referrerpolicy=“strict-origin-when-cross-origin” 属性才能正常播放。
感谢你举报,@J-Wick4。 关于YouTube现在要求嵌入视频iframes上必须使用referrerpolicy=“strict-origin-when-cross-origin”属性才能正确播放,这建议很棒。!虽然这个具体功能还没有出现在核心 API 中,但有几种方法可以实现类似的行为。 使用事件系统: “JavaScript editor.on('component:update', (component) => { 你的逻辑 }); ``` 替代方法: 听取“selector:add”以获取CSS选择器更改 使用“selector:custom”来表示自定义规则 利用“change:*”事件进行细致跟踪 构建一个插件,...
阅读下方完整回答 ↓问题
GrapesJS版本 [x] 我确认使用最新版本的GrapesJS 你用的是什么浏览器? 勇敢 可复制演示链接 不 描述一下那个虫子 如何复现这个漏洞? 试着在落地页添加YouTube视频,看看情况如何。 预期的行为是什么? YouTube 视频渲染并可播放 目前的行为是什么? YouTube会出错,要求用户访问 YouTube.com 观看视频,因为iframe代码中额外要求一个属性。 问题:YouTube 现在要求 referrerpolicy=“strict-origin-when-cross-origin” 属性 在嵌入视频iframe上进行正确播放。 renderYoutube() 和 renderYoutubeNoCookie() 方法需要修改: 添加:el.setAttribute('referrerpolicy', 'strict-origin-when-cross-origin'); 之后:el.setAttribute('allowfullscreen', 'true'); 如果需要执行某些代码来重现该漏洞,请粘贴到下面: --- a/packages/core/src/domcomponents/view/ComponentVideoView.ts +++ b/packages/core/src/domcomponents/view/ComponentVid...
回答(1)
感谢你举报,@J-Wick4。 关于YouTube现在要求嵌入视频iframes上必须使用referrerpolicy=“strict-origin-when-cross-origin”属性才能正确播放,这建议很棒。!虽然这个具体功能还没有出现在核心 API 中,但有几种方法可以实现类似的行为。 使用事件系统: “JavaScript editor.on('component:update', (component) => { 你的逻辑 }); ``` 替代方法: 听取“selector:add”以获取CSS选择器更改 使用“selector:custom”来表示自定义规则 利用“chang...
相关问答
通过相似的问题讨论继续研究。
问题 #6202
Javascript CDN 在 Grapejs Canvas 上无法使用
葡萄JS版本 [X] 我确认使用最新版本的GrapesJS 你用的是什么浏览器? 129 可复制演示链接 https://grapesjs.com/demo 描述一下那个虫子 const newEditor = grapesjs.init({ fromElement: true...
问题 #5334
在画布中选择自定义组件类型无法正常工作
葡萄JS版本 [X] 我确认使用最新版本的GrapesJS 你用的是什么浏览器? Chrome、Opera、Edge 等 可复制演示链接 https://jsfiddle.net/crszh0jo/6/ 描述一下那个虫子 我正在尝试让它像这里描述的那样工作[[问题] Canva...
问题 #6086
无法读取未定义属性(读取“lastComponent”)和可调整大小的功能无法使用
葡萄JS版本[X] 我确认使用最新版本的GrapesJS你用的是什么浏览器? Edge v128可复现演示链接https://codesandbox.io/p/devbox/github/jdkcoder/cv-builderhttps://stackblitz.com/git...
问题 #5618
导入时旧组件脚本不会被删除。导致脚本重复
葡萄JS版本 [X] 我确认使用最新版本的GrapesJS 你用的是什么浏览器? Edge v120.0.2210.121 可复制演示链接 https://codepen.io/ashwinvalento/pen/jOJMPqx 描述一下那个虫子 如果我们设置了 'config...
与此问题匹配的付费插件
根据问题关键词和标签相关性精选,助你更快交付。
正在加载付费插件推荐……
相关教程
关于同一主题的深入指南。
教程
GrapesJS DevTools: A Developer Panel Inside Your Editor
If you've ever debugged GrapesJS with console.log(editor.getSelected()) and a dozen throwaway event listeners — this post is for you.
教程
How to Build a Production GrapesJS Editor: The Complete Walkthrough of Brief, Preset, Plugins, and Services
A complete walkthrough of building a production GrapesJS editor: how to choose a preset, pick plugins, and scope setup services without burning a sprint.
教程
Big Updates: TinyMCE 8 and Placeholder 2.0 for GrapesJS
In May we shipped major updates to two of our most popular GrapesJS plugins — TinyMCE Inline Text Editor and Placeholder.
浏览插件分类
直接跳转到市场上的插件分类页面。