To find out if a page is in an iFrame, you can use this:
if (window!=window.top) { }
So it's just a matter of checking with window.top.location.hostname (only the domain, not the whole URl. For the entire .href url)
if (window!=window.top) { if(window.top.location.hostname = "www.myAwesomeWebsite.com" || window.top.location.hostname = "myAwesomeWebsite.com" ){ } }
source share