解决办法:
if(self != top) { top.location.href = window.location.href; }
相关概念:self是当前窗口,top是最顶层窗口,parent是父窗口。