I have some JavaScript that is being used to open a new window to print part of page I am using the window.open function and I have set the title of the page as window.open 2nd parameter (see code below),but the title appear 'about:blank' Not 'test'
<script type="text/javascript">
function printPartOfPage(elementId) {
var printContent = document.getElementById(elementId);
var windowUrl = 'about:blank';
var printWindow = window.open(windowUrl, 'test', 'left=50000,top=50000,width=0,height=0');
printWindow.document.write(printContent.innerHTML);
printWindow.document.close();
printWindow.focus();
printWindow.print();
printWindow.close();
}
</script>
Note: i know the question might be repeated but i try all answers it doesn't work for me Like:
1-Set the 1st parameter of open() to 'about:blank'
2- printWindow.document.title = 'test'
the result as shown below