You could wrap your check in a try catch
block. Alternatively you could have the page which is on your host 'call' the parent. (something like parent.notifyReady()
) That way you avoid having to use a setInterval
You could base your logic on whether to call the parent or not by using the document.referrer
property
So on your third page you could have something like this:
if(document.referrer.indexOf('otherdomain.com') != -1) {
// script called via otherdomain.com
parent.notifyReady();
}