且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何判断< script>标签无法加载

更新时间:2023-09-02 23:11:52

脚本标签没有错误事件。您可以判断它何时成功,并假设它在超时后未加载:

There is no error event for the script tag. You can tell when it is successful, and assume that it has not loaded after a timeout:

<script type="text/javascript" onload="loaded=1" src="....js"></script>