Auto load a specific link at various time intervals

Posted by user228837 on Stack Overflow See other posts from Stack Overflow or by user228837
Published on 2009-12-10T14:06:12Z Indexed on 2010/03/21 1:01 UTC
Read the original article Hit count: 510

Filed under:
|
|
|
|

Here's what I need to do. I'm using Google Chrome. I have page that auto-reloads every 5 seconds using a script:

javascript: timeout=prompt("Set timeout [s]"); 
current=location.href; 
if(timeout>0) 
    setTimeout('reload()',1000*timeout); 
else 
    location.replace(current); 

function reload()
{ 
    setTimeout('reload()',1000*timeout); 
    fr4me='<frameset cols=\'*\'>\n<frame src=\''+current+'\'/>'; fr4me+='</frameset>';     
    with(document){write(fr4me);void(close())}; 
}

I found that script by Googling.

The reason why the page auto-reloads every 5 seconds is I'm waiting for a specific link or url to appear in the page. It appears at random times. Once I see the link I'm waiting for, I immediately click the link. That's fine.

But I want more. What I want is the page will auto-reload and I want it to auto-detect the the link I'm waiting for. Once the script finds the link I'm waiting for, it automatically loads that link on a new tab or page.

For example, I'm auto-reloading www.example.com. I'm waiting for a specific url "BUY NOW". When the page auto-reloads, it checks if there's a url "BUY NOW". If it sees one, it should automatically open that link.

Thanks.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about url