2

This:

<link id="printstyle" href="oldprintstyle.css" rel="stylesheet" type="text/css" media="print" />

$('#printStyle2').click(function () {
    $("#printstyle").attr('href', _printStyle2);
    window.print();
    return false;
});

kind of works. I say kind of, as the actual print style is only applied after I click the button with the id 'printStyle2' a second time. What could be the reason for this behavior? Some kind of caching of the old print style?

cs0815
  • 16,751
  • 45
  • 136
  • 299

1 Answers1

0

The browser needs indeed some time to apply all the changes. So:

window.setTimeout(function() { window.print(); }, 1000);

does the trick.

cs0815
  • 16,751
  • 45
  • 136
  • 299