返回列表

打开 iframe 代码

默认分类 2019/09/19 08:05

代码如下:

var urls = [
'https://www.baidu.com/'
]
var stop = false
function createIframe(url){
  const link = url
  let xhr = new XMLHttpRequest()
  xhr.open('GET', url, true)
  xhr.onreadystatechange = () => {
    if (xhr.readyState !== 4) return ''
    let status = xhr.status;
    if (status !== 200) {
      stop = true
      urls.push(link)
    }
  }
  xhr.send()
}
function openWin(){
  if (urls.length < 1 || stop) return '';
  createIframe(urls.pop());
  setTimeout(openWin, 100);
}
stop = false;openWin()
document.body.innerHTML = "var urls=['" + urls.join("','") + "'] <br><br><br><br> 666"


>> 留言评论