<?php

$info=detect();
$info["os"];

function detect()
{
    $os=array("WIN","MAC","LINUX","androide");
    $info['os'] = "OTHER";
    foreach($os as $val)
    {
        if (strpos(strtoupper($_SERVER['HTTP_USER_AGENT']),$val)!==false)
        $info['os'] = $val;
    }
    return $info;
}
?>

<?php

if( $info["os"]=='WIN') {
?>
<script language="Javascript">
window.print();
window.onafterprint = function () {
    window.close();
}
</script>
<?php } else { ?>
<button class="oculto-impresion" onclick="cerrar()" style="background-color: red; /* Green */
    border: none;
    color: white;
    padding: 15px 32px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    width: 100%;">CERRAR</button>

<script language="Javascript">
window.print();

function cerrar() 
{
    window.close();
}
</script>
<?php } ?>
