无法在IE上使用php,javascript打印iframe,而是打印当前页面而不是打印按钮
问题描述:
无法在IE上使用php,javascript打印iframe,而是打印当前页面,而不是打印按钮 因为,当我们点击打印按钮,它出来到index.php页面,而不是它应该留在打印按钮存在当前页面上。我的代码如下 。无法在IE上使用php,javascript打印iframe,而是打印当前页面而不是打印按钮
<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"/>
谢谢Shashank,它为我工作.. –