```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Document</title>
</head>
<body>
<div>loading...</div>
<script>
function pending() {
var script = document.createElement('script');
script.src = '
https://google.com'; // 可换成一个任意无法连接的地址
script.onabort = pending;
script.onerror = pending;
document.body.appendChild(script);
}
pending();
</script>
</body>
</html>
```
测试可行 不过手动点击浏览器的停止加载按钮还是会失效 不明白为什么会有这种需求 😓