原先想采用div+ajax实现,但是各种问题,最无法解决的是跨域访问的问题,所以只能借助frame实现了,源码如下:
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>计算页面加载时间</title>
</head>
<body>
<div style="margin:10px">
<input type="text" id="in-url" style="width:450px;height:30px" value="https://www.baidu.com" >
<button id="go">Go!</button>
</div>
<div style="margin:10px">
<label id="lbStatus"></label>
</div>
<div style="margin:10px; width:100%; height:450px; min-height:450px">
<iframe id="fm" width="100%" height="450px" src="https://www.baidu.com"></iframe>
</div>