You can't know how long to set the timeout but you can make the entire thing effectively async. Certainly a async API might be nice in the future. I'm just pointing out what's available now. Note: You probably need Chrome 20 to get the full effect.
Unfortunately, if you don't wait long enough, you can't distinguish whether the false result means "the link failed" or "the link hasn't happened yet (so wait and try again)". It's pretty close, though.