print() not working on opera browser

后端 未结 4 857
眼角桃花
眼角桃花 2021-01-07 04:21

I am trying to open a print dialog box in Opera browser using javascript. The print() is working fine in all browsers but in opera it doesn\'t work. My p

4条回答
  •  滥情空心
    2021-01-07 05:06

    In Opera, the print dialog will only display if the page has loaded (see the link in cjrh's comment), so maybe the window you're dynamically opening has not finished loading when you try to print it. Try replacing this line:

    printWindow.print();
    

    with this line:

    printWindow.onload = printWindow.print;
    

提交回复
热议问题