S或通过浏览器下载选项从浏览器下载网页

S或通过浏览器下载选项从浏览器下载网页

本文介绍了如何阻止任何人使用Ctrl + S或通过浏览器下载选项从浏览器下载网页?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图限制用户从浏览器中将页面下载为.html或.aspx文件.

I am trying to restrict the user from downloading the page as .html or .aspx file from browser.

或者如果下载了文件,是否可以更改文件的内容?

Or is there a way to change the content of file if its downloaded?

推荐答案

这是一个复杂的区域,有许多活动部件.简短的答案是没有办法获得100%的成功;您可以做一些事情使事情变得更艰难".

This is a complex area, with lots of moving parts. The short answer is "there is no way to do this with 100% success; there are a few things you can do which make it harder".

首先,您可以包含JavaScript以禁用右键单击上下文菜单.这不会停止Ctrl + S,但可能会阻止随意的尝试.

Firstly, you can include JavaScript to disable the right click context menu. This doesn't stop Ctrl+S, but might discourage casual attempts.

第二,您可以在浏览器中使用 DRM (尽管这主要是为了保护媒体内容.由于整个浏览器都支持浏览器,所以目前这还不现实.

Secondly, you can use DRM in the browser (though this is primarily aimed at protecting media content. As browser support is all over the show, this isn't realistic right now.

第三,您可以单页Web应用程序,并将某种程度的身份验证构建到检索内容"逻辑中.这样,将页面保存到磁盘不会带走内容,而只是带页面家具".但是,您包括的仅在您认为时才下载内容的任何机制很可能会被那些有一定动机的人轻易地颠覆.

Thirdly, you could write your site as a single page web application, and build some degree of authentication into the "retrieve content" logic. This way, saving the page to disk wouldn't bring the content along, just the "page furniture". However, any mechanism you include to only download content when you think you should is likely to be easily subverted by anyone who is moderately motivated.

此外,您采取的任何措施阻止人们在本地保留您的页面,都有可能破坏Internet依赖于性能的缓存机制,因此您的网站可能会急剧地变慢.

Also, any steps you take to stop people persisting your pages locally are likely to break the caching mechanisms on which the internet depends for performance, so your site would likely be dramatically slower.

这篇关于如何阻止任何人使用Ctrl + S或通过浏览器下载选项从浏览器下载网页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 06:46