Wrong value from document.documentElement.clientHeight etc

Samsung Internet Version 28.0.0.57
Galaxy S24+ (Android Version 14)

Sometimes, window.innerHeight, document.documentElement.clientHeight and window.visualViewport.height doesn’t work.

Example) ---------------------------------------------

<!DOCTYPE html>
<html lang="ko">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width"> <title>Test</title>
</head>
<body>

  <div id="pdf-container">
  </div>

<script type="module">
window.onload = function(){
    alert(window.innerHeight);
    alert(document.documentElement.clientHeight);
    alert(window.visualViewport.height);
}
</script>

</body>
</html>

If this page is the first one opened in private Browse mode, an alert occasionally displays an incorrect value.
How could I get correct value?