For a project I need to print a document using PHP code. Currently I have a self closing pop up to start the print.
The only problem I have is that a user could spam the button creating a lot of print requests and a huge queue.
The code I have right now:
function newPopup(url) {
popupWindow = window.open(
url,'popUpWindow','height=10,width=100,left=10,top=10,resizable=no,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=no'); // Verstop op achtergrond
popupWindow.blur();
}
<a href="JavaScript:newPopup('print.php');">Print</a>
I have found some code to stop links but I have problems implementing these since I already call it as a pop up.
You can use a flag:
Not a "good" solution (uses a global variable), but it should work.