Search code examples
javascriptangulartypescript

When clicking print button print dialog box is not appearing to some users


When i am going to clicking print button print dialog box is working fine with my side, but some users are complaining they are not getting print dailog after clicking print button into production site, i have check from my side locally and production but both side working fine not able to find any issue from my side, please suggest.

Below is my html

enter image description here

below is my angular component methods on button click

  public downloadPDF() {
    var printContents = document.getElementById('contentToConvert').innerHTML;
    debugger;
    if (this.Popup(printContents)) {
    }
  }

 Popup(data) {
    debugger;
    var mywindow = window;
    mywindow.print();
    mywindow.close();

    return true;
  }

Solution

  • In Lastest version of chrome browser: working fine with 126 version chrome and not working 127 and greater than chrome version.

    So I have removed below than working fine to me.

    mywindow.close();