脚本标记的SRC和内容意味着什么?

2018-03-14

usr提出了一个问题:What does a script-Tag with src AND content mean?,或许与您遇到的问题类似。

回答者Jeremy Banks给出了该问题的处理方式:

Different browsers treat this differently. Some run the content only if the srcis included without error. Some run it after attempting to include the srcscript, regardless of success. Since this behaviour is unreliable (and prohibited in HTML5), it should be avoided.

Google isn't relying an any specific behaviour. Since the content is just an object literal (a value), executing it would not actually do anything except cause a silent error. Google's code looks at the contents of the scripttag itself, and adjust its behaviour based on that.

希望本文对你有帮助,欢迎支持JavaScript中文网

原文链接:stackoverflow.com

上一篇:关于我的项目和这些JavaScript框架,我错在哪里?
下一篇:为什么是数学。pow()(有时)不等于**在JavaScript呢?
相关教程
关注微信

扫码加入 JavaScript 社区

相关文章

首次访问,需要验证
微信扫码,关注即可
(仅需验证一次)

欢迎加入 JavaScript 社区

号内回复关键字:

回到顶部