Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to close window after alertbox get closed inside php

I need to close the window after alertbox, I used the codes which was asked in Stack Question But my alert box is inside a php code, I am getting the alert box but once i close it the window is not getting closed, I am new to php . The codes are below, Please help me out guys

<?php 
$serial_get = trim(str_replace("(","",str_replace(")","",GetVolumeLabel("d"))));
 if ($serial_get == '1233-2AZ2'){ 
} 
else{
 echo '<script language="javascript">
window.alert("This is not a Licensed Software. Please contact IT Solutions.");
window.close()
</script>'; }?>
like image 422
Zain Avatar asked Nov 09 '22 21:11

Zain


1 Answers

You need window.open(...) to be able to window.close(). You are using window.alert().

See Best Practice in the link https://developer.mozilla.org/en-US/docs/Web/API/Window.open

like image 162
Ikmal Ezzani Avatar answered Nov 14 '22 21:11

Ikmal Ezzani