禁用 DFP iframe 以访问父级 window
Disable DFP iframes to acces parent window
我遇到了显示没有关闭按钮的插页式广告的恶意广告的一些问题。
检查代码,我发现 DFP 使用 <iframe>
标记加载广告,但由于这些 iframe 的内容是使用 Javascript 加载的(使用 iframe 的 document.write()
,没有src
属性),他们通过 window.top
和 window.top.document
获得对父 window 的完全访问权限,允许广告商注入代码、展示恶意广告甚至窃取用户电子邮件和密码。
为了防止这种情况,我正在寻找一种方法来阻止 DFP 广告访问主 window。可能吗?
考虑使用 SafeFrames
而不是您似乎正在使用的 Friendly Iframes
。引用 DFP 的 help page 关于这个主题:
We recommend using SafeFrames and creatives compatible with SafeFrame for expansion instead of friendly iframes. SafeFrame is supported in DFP and enabled by default when using GPT tags. It enables transparent and rich interactions between page content and ads, while preventing external access to sensitive data and providing more granular control over which creatives are rendered
我觉得你用的是同步渲染,试试改成异步的
我遇到了显示没有关闭按钮的插页式广告的恶意广告的一些问题。
检查代码,我发现 DFP 使用 <iframe>
标记加载广告,但由于这些 iframe 的内容是使用 Javascript 加载的(使用 iframe 的 document.write()
,没有src
属性),他们通过 window.top
和 window.top.document
获得对父 window 的完全访问权限,允许广告商注入代码、展示恶意广告甚至窃取用户电子邮件和密码。
为了防止这种情况,我正在寻找一种方法来阻止 DFP 广告访问主 window。可能吗?
考虑使用 SafeFrames
而不是您似乎正在使用的 Friendly Iframes
。引用 DFP 的 help page 关于这个主题:
We recommend using SafeFrames and creatives compatible with SafeFrame for expansion instead of friendly iframes. SafeFrame is supported in DFP and enabled by default when using GPT tags. It enables transparent and rich interactions between page content and ads, while preventing external access to sensitive data and providing more granular control over which creatives are rendered
我觉得你用的是同步渲染,试试改成异步的