Print button not working on safari browser in mobile view - Hack The Tech - Latest News related to Computer and Technology

Hack The Tech - Latest News related to Computer and Technology

Get Daily Latest News related to Computer and Technology and hack the world.

Wednesday, April 26, 2023

Print button not working on safari browser in mobile view

Please don't suggest a window print button. I have to generate HTML to PDF click on the button

<div id="stickerarea">Print this section when click on below button</div>

<button type='button' class='print_sticker' id='print_sticker'>Print</button>

Go to this website http://mybabywipes.com/customize.php page. Please fill in all your details, After all details finish on the page click on the Print Order button. In front of you have two options, please continue with the guest user. The new page open page heading is "Download Customized Baby Wipes Label" Click on this print button it's not working on iPhone Safari. chrome browser this working but all 4 labels are not showing properly. Anyone, please help me out

<script>
$(document).ready(function() {
        $('#print_sticker').on('click',function(event) {
            event.preventDefault();
            var id = $(this).data('id');
            $('#stickerarea').html('');

                $.get('print_label.php',{id:id}).done(function(data) {
                    var HTML = data;
                    $('#stickerarea').append(HTML).css({"display":" block"});
                    var divContents = document.getElementById("printviewInfo").innerHTML;
                var a = window.open('', '', 'height=700, width=500');
                a.document.write('<html>');
                a.document.write('<body ><br>');
                a.document.write(divContents);
                a.document.write('</body></html>');
                a.document.close();
                a.focus();
                setTimeout(function () { a.print(); }, 500);
        a.onfocus = function () { setTimeout(function () { a.close(); }, 500); }
                    
                });
        });
    });

</script>


source https://stackoverflow.com/questions/76104287/print-button-not-working-on-safari-browser-in-mobile-view

No comments:

Post a Comment