小程序web-view打开页面index02.html,切后台,息屏,挂起5分钟后热启动,概率出现点击链接后需要5-110秒(甚至更长时间)才能跳转过去的情况。
如果把for循环里面的代码改成ajax或fetch请求服务器,跳转缓慢的现象更明显,请求的响应数据越多现象越明显。
点击链接后等待跳转的时间内,如果把网络关闭会显示“无法打开页面”提示,点击屏幕重新加载会显示跳转后的index01.html。
index01.html
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<a href="/index02.html">链接</a>
<div>
<p>0</p>
<p>1</p>
<p>2</p>
<p>3</p>
<p>4</p>
<p>5</p>
<p>6</p>
<p>7</p>
<p>8</p>
<p>9</p>
</div>
</body>
</html>
index02.html
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<a href="/index01.html">链接</a>
<div>
<p>0</p>
<img src="0.jpg" />
<p>1</p>
<img src="1.jpg" />
<p>2</p>
<img src="2.jpg" />
<p>3</p>
<img src="3.jpg" />
<p>4</p>
<img src="4.jpg" />
<p>5</p>
<img src="5.jpg" />
<p>6</p>
<img src="6.jpg" />
<p>7</p>
<img src="7.jpg" />
<p>8</p>
<img src="8.jpg" />
<p>9</p>
<img src="9.jpg" />
<script>
for (var i of document.getElementsByTagName("p"))
i.innerHTML += "-脚本完成";
</script>
</div>
</body>
</html>