'Can we edit title of windows alert box being used in Google Apps script?

Can we customize the title in alert box for a webapp created using google apps script ?

enter image description here

function confirmReserve(text){
  document.body.style.cursor = 'auto';
  console.log('text = '+text);
  alert(text);
}


Solution 1:[1]

The title on an alert can't be changed due to security reasons, to let the user know who is sending it and to avoid possible phishing.

You could use a modal box to display the message you want. As an example:

HTML:

<!DOCTYPE html>
<html>

<head>
  <base target="_top">
</head>

<body>
  <button id="myBtn">Open Modal</button>
  <div style="display: none" id="myModal" class="modal">
    <div class="modal-content">
      <span class="close">&times;</span>
      <p>Some text in the Modal..</p>
    </div>
  </div>
</body>
<script>
var modal = document.getElementById("myModal");
var btn = document.getElementById("myBtn");
var span = document.getElementsByClassName("close")[0];
btn.onclick = function() {
  modal.style.display = "block";
}
span.onclick = function() {
  modal.style.display = "none";
}
window.onclick = function(event) {
  if (event.target == modal) {
    modal.style.display = "none";
  }
}
</script>

</html>

You can then style the modal as an alert using CSS.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kessy