开发者

Wait until print is complete - Jquery Asp.net MVC

I am a newbie. please excuse me if it is a very basic question. I am hiding and showing CSS on window.print(). on IE8 and FF The page execution stops until i respond on print ( either print or cancel) and then it starts again and completes the page load. But on IE6 and IE7 the page load is not waiting until i respond on print dialog box. How can I pause Page execution until I respond ( either print or cancel) on the print dialog box? I do not want to use se开发者_如何学Pythonttimeout since it is for a specific time. If i choose to print immediately the page will not load untill settimeout expires and vice versa. Please help.


Don't hide and show on window.print(). It will never work correctly, and will cause other issues.

Instead, use a separate, print CSS file:

<link href="/Content/Print.css" rel="stylesheet" type="text/css" media="print"/> 

This file will define styles for printing, like:

.noprint
{
    display: none !important;
}

You can then mark up elements you don't want to print:

<img class="foo bar noprint" ...

Unlike hiding and showing on window.print(), this works with JavaScript disabled.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜