如何在iframe中禁用打印功能和只读文件? [英] How to disable print function and readonly file in iframe?

查看:596
本文介绍了如何在iframe中禁用打印功能和只读文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,



我可以知道如何在iframe中禁用打印功能和只读文件吗?请建议谢谢。



例如我写下面的代码声明,我需要禁用打印功能,不允许打印和只读。







< iframe

src =MKZHR-01- 002(V000)%20.pdf#toolbar = 0& navpanes = 0& statusbar = 0& view = Fit; readonly = true; disableprint = true;

width =1024height = 800>< / iframe>

Dear All,

May i know how disable print function and readonly file in iframe ? kindly advise thank you.

example i write as below code statement, i need to disable print function and not allow to print out and read only.



<iframe
src="MKZHR-01-002(V000)%20.pdf#toolbar=0&navpanes=0&statusbar=0&view=Fit;readonly=true; disableprint=true;"
width="1024" height="800" ></iframe>

推荐答案

您无法在浏览器上禁用打印功能,但可以使用window.onafterprint和window来控制打印内容。 onbeforeprint。以下是样本



You can not disable print functionality on browser, but you can control the content of print using window.onafterprint and window.onbeforeprint. Below is sample

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>
	Untitled Page
</title>
    <style>
    @media print
  {
     .hide
     {
     	display:none;
     }
  }
    </style>
</head>
<body>
    <form name="form1" method="post" action="WebForm4.aspx" id="form1">
<div>

</div>
 
    <div>
        <iframe src="http://www.w3schools.com/css/css_mediatypes.asp" id="iframe1" class="hide"></iframe>
    </div>
    </form>
 
    <script>
    
  
    </script>
 
</body>
</html>


这篇关于如何在iframe中禁用打印功能和只读文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆