1

Yes I have seen other questions about this too, but they have not helped me, so this is my code.

$("#raspe4atat_<?= $ui->item_id ?>").click(function(){
    $.ajax({
        url: "/raspe4atat/<?= $ui->item_id ?>",
        type: "GET",
        success: function(){
            $.ajax({
                url: "/iframe/<?= $ui->item_id ?>",
                type: "GET",
                success: function(r){
                    $("#not_enough_money_<?= $ui->item_id ?>").append(r);
                    setTimeout(function(){
                        document.getElementById('pdf_<?= $ui->item_id ?>').contentWindow.print();
                        //window.frames['iframe_<?= $ui->item_id ?>'].print();
                    }, 1000);
                }
            });
        }
    });
    return false;
});

and this is the iframe:

<iframe name="iframe_<?= $ui->item_id ?>" style="position: absolute; top: -1000px;" id="pdf_<?= $ui->item_id ?>" src="<?= base_url().'pdf/'."coupon_info_".$ui->user_id.'.pdf' ?>" width="0" height="0">
</iframe>

this code works in google chrome, but in firefox it didn't.

first it creates the pdf in the server, then it generates in the page, and then it waits 1 second and then prints it, but it doesnt' work in firefox, if i discomment the commented line, then firefox asks if i want to stop more dialog windows? can you help me?

Bhavik Hirani
  • 1,996
  • 4
  • 28
  • 46
yeah its me
  • 1,131
  • 4
  • 18
  • 27

1 Answers1

0

It seems to me that the browser you are checking will be out of date, as I have checked the following code in all browsers and it works fine. I checked in Chrome, Firefox and Opera, and I also checked with IE and it worked well in all browsers.

So please update your browser first.

window.frames['iframe_1'].focus();
window.frames['iframe_1'].print();
Bhavik Hirani
  • 1,996
  • 4
  • 28
  • 46