gpt4 book ai didi

javascript - AMP 如何在页面中包含 javascript 并应用此脚本中的函数

转载 作者:行者123 更新时间:2023-11-30 20:48:09 24 4
gpt4 key购买 nike

我一直在尝试在 AMP 页面中包含一个 javascript 文件,但每次都失败

<amp-iframe width="200" height="100px" 
layout="responsive" sandbox="allow-scripts allow-same-origin"
src="https://laraflat.000webhostapp.com/public/js/index2.js">

</amp-iframe>

但它无法加载此脚本中的函数

最佳答案

AMP 禁止使用外部 javascript 库。您只能使用原生 AMP 组件的脚本。

JavaScript is powerful, it can modify just about every aspect of the page, but it can also block DOM construction and delay page rendering (see also Adding interactivity with JavaScript). To keep JavaScript from delaying page rendering, AMP allows only asynchronous JavaScript.

欲了解更多信息,请访问 here

关于javascript - AMP 如何在页面中包含 javascript 并应用此脚本中的函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48477175/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com