SOURCE

console 命令行工具 X clear

                    
>
console
function message(){
  try{
    dalert("Hello Gril!")
  }
  catch(err)
  {
    txt="此页面存在错误信息。\n\n";
    txt+="错误描述:"+err.description+"\n\n";
    txt+="点击确定继续";
    // alert(txt);
    if(!confirm(txt)){
      document.location.href="/index.html"
    }
  }
}
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <title>Document</title>
</head>
<body>
  <input type="button" value='点击查看消息' onclick='message()'/>
</body>
</html>