代码示例:(标识:jsref_location_breakout)
<!DOCTYPE html>
<html>
<head>
<script>
function breakout() {
  if (window.top != window.self) {
    window.top.location = "/index.php";
  }
}
</script>
</head>
<body>

<input type="button" onclick="breakout()" value="跳出框架">

</body>
</html>
运行结果: