js 访问 URL 链接
直接上代码
var url = "https://www.cnblogs.com/xuchunlin/p/14848864.html" var time = 10000; var timeout = false; var request = new XMLHttpRequest(); var timer = setTimeout(function() { timeout = true; request.abort(); }, time); request.open("GET", url); request.onreadystatechange = function() { if (request.status === 200) { // 打印出网页结果 console.log(request.responseText); } } ; request.send(null);
如果觉得对您有帮助,麻烦您点一下推荐,谢谢!
好记忆不如烂笔头
好记忆不如烂笔头