Я хочу использовать AMP Consent модуль для страниц AMP, но он не работает правильно, когда код находится на моей странице.
Я использую пример на сайте amp.dev: https://playground.amp.dev/amp/undefined?mode=Galaxy+S5
Здесь код, который я использую на своей странице, это сокращенный пример: https://jsfiddle.net/xzvb9pwk/
<amp-consent id="myConsent" layout="nodisplay">
<script type="application/json">
{
"consentInstanceId": "advanced-consent",
"consentRequired": false,
"promptUI": "consentDialog",
"postPromptUI": "post-consent-ui"
}
</script>
<div class="lightbox" id="consentDialog">
<div class="lightbox-content">
<div class="dismiss-button" role="button" tabindex="0" on="tap:myConsent.dismiss">X</div>
<div class="message">
<h2>Headline</h2>
<p>This is an important message requiring you to make a choice.</p>
</div>
<div id="choice">
<button on="tap:choice2.show,choice1.hide">Choice 2</button>
</div>
<div id="choice1" hidden class="message">
<p>This is some more information about this choice. Here's a list of items related to this choice.</p>
<button on="tap:myConsent.accept">Confirm</button>
</div>
<div id="choice2" hidden class="message">
<p>This is some more information about this choice.</p>
<button on="tap:myConsent.reject">Confirm</button>
</div>
</div>
</div>
<div id="post-consent-ui">
<button on="tap:myConsent.prompt()">Update Consent</button>
</div>
</amp-consent>
Код JSFiddle работает на AMP Playground , но не на JSFiddle или моей странице.
У меня нет ошибки в консоли браузера и Google Chrome Плагин AMP ( AMP Validator ) говорит, что моя страница соответствует требованиям.