Sometimes, we want to auto start print HTML page using JavaScript.
In this article, we’ll look at how to auto start print HTML page using JavaScript.
How to auto start print HTML page using JavaScript?
To auto start print HTML page using JavaScript, we call print when the page is loaded.
For instance, we write
window.onload = () => {
window.print();
};
to set window.onload to a function that’s called when the page finishes loading.
In it, we call window.print to open the print dialog.
Conclusion
To auto start print HTML page using JavaScript, we call print when the page is loaded.