gpt4 book ai didi

javascript - 设置已有脚本标签的 src 属性

转载 作者:行者123 更新时间:2023-11-28 14:31:21 25 4
gpt4 key购买 nike

当我尝试设置具有另一个 src 属性值的脚本标记的 src 属性时,该属性被修改,但脚本不执行。

我知道还有其他选择,例如创建新的脚本标记并设置其 src 属性,但为什么设置已存在的脚本标记的 src 属性完全无用?

最佳答案

因为documentation是这么说的。

Changing the src, type, nomodule, async, defer, crossorigin, integrity, and referrerpolicy attributes dynamically has no direct effect; these attributes are only used at specific times described below.

我不会复制 whole process paragraph这里虽然很长,但长话短说:每个脚本元素都是一个小型状态机,并且 src 属性仅在第一次处理元素时在一个特定状态下使用(在链接段落)。

关于javascript - 设置已有脚本标签的 src 属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51408573/

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