![](/img/trans.png)
[英]Unable to print an iframe on IE using JavaScript, prints parent page instead
[英]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.