My problem is that I\'m creating an application that will be added to different pages in an iframe. But sometimes it will be on my own domain and sometimes on some one elses
You could use:
try{ parent.document; // accessible }catch(e){ // not accessible }