Browser file loading actually has very complicated compatibility issues. Recently I saw @lifesinger make a specific summary. The troublesome thing here is that IE6~8 does not distinguish between successful or failed loading, and all take a callback. A solution I saw online is to set a global variable at the end of the loaded file or change the attribute of the label to distinguish it, so that the success or failure can be judged by this flag. But it's obviously not perfect, and the file needs to be loaded.
Later I tried another idea, first create a vbscript, and set the src to a JS file. If the file loads normally, an error will definitely be reported, otherwise there will be no response. In this way, if window.onerror catches an error, it means that the file is valid and can be loaded normally. If not captured, a timeout will be triggered after n seconds.
This part of the code: