Reputation: 15
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
Please wait for few seconds, until this `Dialogue Box` closes. This waiting time is required for the Page to Load Completely. Thank you.<input type="button" value="Close" onclick="google.script.host.close()" />
</body>
</html>
Instead of the user clicking on Close button
,
I want the onclick
operation to happen automatically after few seconds. Please help.
Upvotes: 0
Views: 77
Reputation: 83
Because of security issues closing a window is disabled unless the same script created that window. But if you want to click that button after a specific time use setTimeout() function.
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
Please wait for few seconds, until this `Dialogue Box` closes. This waiting time is required for the Page to Load Completely. Thank you.
<input type="button" value="Close" id="myButtonId" onclick="myfunction()" /><br>
<script type="text/javascript">
setTimeout(function () {document.getElementById("myButtonId").click();}, 3000);
function myfunction(){
alert("clicked");
}
</script>
</body>
</html>
Upvotes: 1