Thursday 1 March 2018

HTML Print Page functionality


We are getting some simpler task some days and we learn new things about technology or language which is always there, but we are never aware of it. We use it sometimes too but unaware how it is working until you need to develop it.

So we have a simple request that client wants print functionality in page. No big deal. JavaScript provides such functionality with simple command "window.print();". Just use below code and you are good to go:


<button onclick="window.print();">Print this page</button>


All browsers use their own way of printing. So the user experience will be different.


No comments:

Post a Comment