-1
I would like to do a post-print action, IE, only when the user confirms the impression that javascript will run a scheduled event. If I put an event under the window.print()
javascript runs even without the user having printed it yet. Something like:
window.print() = function(){
[...]
}
I heard about matchMedia
, but I didn’t understand. It would have as an example from the code below?
1) Before printing want yellow screen background;
2) After printing want green screen background;
<html>
<head>
<title>teste</title>
<script>
function imprimir() {
window.print()
}
</script>
</head>
<body>
<input type="button" value="imprimir" onclick="imprimir()" />
</body>
</html>