判断iframe页面是否是顶层页面

if (self!=top) { 
  window.parent.location.reload();
}

原文地址:https://www.cnblogs.com/rickons/p/9635171.html