/
githubmirror
/
amphtml
Обзор
Документация
Войти
/
githubmirror
/
amphtml
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
examples/amp-consent/amp-consent-iframe.embed.html
31 строка
813 B
Caroline Liu
Apply bulk transform to html tags (#34836)
15 июн 2021, 21:07
Не верифицирован
15 июн 2021, 21:07
3ace35c
Код
Авторство
О чём код?
<!DOCTYPE html> <html lang="en"> <body style="background-color:#EEEEEE"> <script> function isAmpMessage(event, type) { return ( event.source == window.parent && event.origin != window.location.origin && event.data && event.data.sentinel == 'amp' && event.data.type == type ); } window.addEventListener('message', (event) => { if (!isAmpMessage(event, 'consent-data')) { return; } console.log('message', event); document.getElementById('consent').innerText = JSON.stringify(event.data, null, 2); }, false); window.parent.postMessage({ sentinel: 'amp', type: 'send-consent-data' }, '*'); </script> <pre id="consent"> Iframe loaded but did not receive consent </pre> </body> </html>