I want to make a button to print newly created html page and print it staying in the index page of my website. Now I have a workaround, open the page I want to print, immediately open print menu and then redirecting to the main page
window.onload = function () {
window.print();
document.location.href = "/";
}
Is there any elegant solution for that?