繁体   English   中英

无法使用php,javascript在IE上打印iframe,而是打印当前页面,而不是有打印按钮

[英]Unable to print an iframe on IE using php,javascript, prints current page instead in which there is print button

无法使用php,javascript在IE上打印iframe,打印当前页面而不是有打印按钮以及当我们点击打印按钮时它出现在index.php页面而不是它应该保留在打印当前页面上按钮存在。 我的代码如下。

<iframe  id="frame1" src="splits-sorting-print.php" name="frame1" style="display:none;"></iframe>

 <a href="javascript:void(0);"  onclick="frames['frame1'].print()" class="btn btn-back" ><i class="fa fa-print"></i>Print</a>

我也尝试过其他方式,但没有奏效

 <script type="text/javascript">
               function printie()
             {
               try
                {
                    iframe = document.getElementById('frame1');
                    iframe.contentWindow.document.execCommand('print', false, null);
                }
                catch(e)
                {
                    window.print();
                }
            }
    </script>


 <a href="javascript:void(0);"  onclick="printie();" class="btn btn-back" ><i class="fa fa-print"></i>Print</a>

除了IE之外,所有的工作都适用于铬和火狐。 请帮我解决这个问题。 提前致谢。

我也遇到了同样的问题,这个问题对我有用。

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE11"/>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM