Skip to content

Instantly share code, notes, and snippets.

@yinheli
Created August 29, 2014 04:12
Show Gist options
  • Save yinheli/6575667457b285cb28fa to your computer and use it in GitHub Desktop.
Save yinheli/6575667457b285cb28fa to your computer and use it in GitHub Desktop.
自动访问一遍页面的全部链接, 如果这个页面用了 jQuery
var idx = 0;
var hrefPool = new Array();
hrefPool.push('/signup');
hrefPool.push('/signin');
hrefPool.push('/signout');
$('a').each(function(){
var href = $(this).attr('href');
if (href.indexOf('http') != -1) {
return
}
if (hrefPool.indexOf(href) != -1) {
return
}
var id = idx
// console.log(id)
setTimeout(function(){
console.log(id + "-->" + href);
$.get(href);
}, 10000 * id);
hrefPool.push(href);
idx++;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment