为 amp-ad 提供动态回退
Provide dynamic fallback for amp-ad
我想使用 "amp-ad" 标记作为另一个 amd-ad 的后备。
这是示例:
<amp-ad width="300"
height="200"
type="MY_PROVIDER"
data-slot="MY_SLOT">
<div fallback>
<!-- Try to insert fallback amp-ad here -->
</div>
</amp-ad>
3d 方广告提供商 (MY_PROVIDER) 可以 return 另一个 amp-ad 标记(来自另一个提供商)作为后备。
如果我只是将此标记插入主广告容器,它不会被执行:
document.getElementById('c').innerHTML = '<amp-ad width="300" height="200" type="MY_FALLBACK_PROVIDER" data-slot="MY_FALLBACK_SLOT"></amp-ad>'; //will not work
有什么方法可以将此后备 amp-ad 标记动态插入到主机(顶部)页面的后备容器中?
引用 amp 文档中的一段话:
A fallback is a convention that allows the element to communicate to the reader that the browser does not support the element
回退只是传达失败的一种方式。
我想使用 "amp-ad" 标记作为另一个 amd-ad 的后备。 这是示例:
<amp-ad width="300"
height="200"
type="MY_PROVIDER"
data-slot="MY_SLOT">
<div fallback>
<!-- Try to insert fallback amp-ad here -->
</div>
</amp-ad>
3d 方广告提供商 (MY_PROVIDER) 可以 return 另一个 amp-ad 标记(来自另一个提供商)作为后备。 如果我只是将此标记插入主广告容器,它不会被执行:
document.getElementById('c').innerHTML = '<amp-ad width="300" height="200" type="MY_FALLBACK_PROVIDER" data-slot="MY_FALLBACK_SLOT"></amp-ad>'; //will not work
有什么方法可以将此后备 amp-ad 标记动态插入到主机(顶部)页面的后备容器中?
引用 amp 文档中的一段话:
A fallback is a convention that allows the element to communicate to the reader that the browser does not support the element
回退只是传达失败的一种方式。