/
githubmirror
/
amphtml
Обзор
Документация
Войти
/
githubmirror
/
amphtml
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
extensions/amp-iframe/1.0/example/index.html
48 строк
1 KB
Alan Orozco
📖 Populate Bento hero examples from READMEs (#36900)
12 ноя 2021, 04:50
Не верифицирован
12 ноя 2021, 04:50
29aa22a
Код
Авторство
О чём код?
<!DOCTYPE html> <html> <head> <script type="module" async src="https://cdn.ampproject.org/bento.mjs" ></script> <script nomodule src="https://cdn.ampproject.org/bento.js"></script> <script type="module" async src="https://cdn.ampproject.org/v0/bento-iframe-1.0.mjs" ></script> <script nomodule async src="https://cdn.ampproject.org/v0/bento-iframe-1.0.js" ></script> <link rel="stylesheet" type="text/css" href="https://cdn.ampproject.org/v0/bento-iframe-1.0.css" /> </head> <body> <bento-iframe id="my-iframe" src="https://en.wikipedia.org/wiki/Bento" style="width: 800px; height: 600px" > </bento-iframe> <button id="change-source">Change source</button> <script> (async () => { const iframeEl = document.querySelector('#my-iframe'); await customElements.whenDefined('bento-iframe'); // Reload iframe with new src document.querySelector('#change-source').onclick = () => { iframeEl.setAttribute('src', 'https://example.com'); }; })(); </script> </body> </html>