if (window !== top) { top.location.href = "a"; } else { window.location.href = "b"; }
其实就是
top.location.href 和 window.location.href 的区别