📌  相关文章
📜  是否可以防止用户截取网页截图?

📅  最后修改于: 2021-11-03 10:40:48             🧑  作者: Mango

屏幕截图是 Windows操作系统的一项功能。我们可以简单地按下键盘上的打印屏幕(print screen)来进行截图。如果键盘没有prt sc键,我们可以使用Fn + Windows 徽标键 + Space Bar 。此外,我们可以通过按Windows 徽标键 + Shift + S并选择屏幕截图区域来使用 Snip & SketchSnipping 工具。

在 MacOS 中,我们可以使用Command + Shift + 3Command + Shift + 4进行截图。

所有这些命令都由我们的操作系统控制,我们无法使用 HTML/CSS/JavaScript 在浏览器中禁用或阻止它们。所以,我们不能阻止用户截屏。

除此之外,如果用户想要获取我们网页的内容,他们可以复制、打印、使用某些第三方应用程序或使用其他设备拍照。因此,很难阻止用户截取我们网页的屏幕截图或内容。

我们无法阻止这一切,但我们可以通过一些方法在一定程度上避免这一切。

示例 1:在此示例中,我们将禁用网页的打印选项。

HTML


 

    

 

    
        Python is a high-level, general-purpose         and a very popular programming language.         
Python programming language (latest         Python 3)is being used in web development,         
Machine Learning applications, along         with all cutting edge technology in         Software Industry.
Python Programming         Language is very well suited for Beginners,         
also for experienced programmers with         other programming languages like C++ and         Java.
    
 


HTML


 

    

 

    
        Python is a high-level, general-purpose         and a very popular programming language.         
Python programming language (latest         Python 3)is being used in web development,         
Machine Learning applications, along         with all cutting edge technology in         Software Industry.
Python Programming         Language is very well suited for Beginners,         
also for experienced programmers with         other programming languages like C++ and         Java.
    
 


HTML


 

    

 

    
        Python is a high-level, general-purpose and         a very popular programming language.
        Python programming language (latest Python 3)         is being used in web development,
        Machine Learning applications, along with all         cutting edge technology in Software Industry.         
Python Programming Language is very well         suited for Beginners, also for
        experienced programmers with other programming         languages like C++ and Java.
    
 


HTML


 

    

 

    
        Python is a high-level, general-purpose and         a very popular programming language.
        Python programming language (latest Python 3)         is being used in web development,
        Machine Learning applications, along with all         cutting edge technology in Software Industry.         
Python Programming Language is very well         suited for Beginners, also for
        experienced programmers with other programming         languages like C++ and Java.

    
      
         

            © 2021 GFG All the content of this             webpage belongs to us         

      
 


输出:这将简单地输出我们网页的内容,但是当我们尝试打印它时,我们什么也得不到。

无法打印

示例 2.在本示例中,我们将使用 CSS 更改文本选择功能。

HTML



 

    

 

    
        Python is a high-level, general-purpose         and a very popular programming language.         
Python programming language (latest         Python 3)is being used in web development,         
Machine Learning applications, along         with all cutting edge technology in         Software Industry.
Python Programming         Language is very well suited for Beginners,         
also for experienced programmers with         other programming languages like C++ and         Java.
    
 

输出:这将阻止用户选择和复制我们的文本内容。

复制没有发生

示例 3.在此示例中,我们将向用户显示警告消息,不要复制/窃取/打印/截取我们的网页。

HTML



 

    

 

    
        Python is a high-level, general-purpose and         a very popular programming language.
        Python programming language (latest Python 3)         is being used in web development,
        Machine Learning applications, along with all         cutting edge technology in Software Industry.         
Python Programming Language is very well         suited for Beginners, also for
        experienced programmers with other programming         languages like C++ and Java.
    
 

输出:这将向用户显示一条警告消息,提示他不应截取此网页的任何屏幕截图。

警告提示信息

例4.在本例中,我们将添加我们网页的版权信息,该信息将显示该网页的所有内容属于我们,并且严禁以任何形式使用我们的内容。

HTML



 

    

 

    
        Python is a high-level, general-purpose and         a very popular programming language.
        Python programming language (latest Python 3)         is being used in web development,
        Machine Learning applications, along with all         cutting edge technology in Software Industry.         
Python Programming Language is very well         suited for Beginners, also for
        experienced programmers with other programming         languages like C++ and Java.

    
      
         

            © 2021 GFG All the content of this             webpage belongs to us         

      
 

输出:我们在页脚中添加了一条版权信息,并带有一条简单的信息。

页脚消息