如何使用HTAccess禁用选择和右键点击?

huangapple go评论56阅读模式
英文:

How to Disable Selection and Right Click wit HTAccess?

问题

There is no direct way to achieve this using the .htaccess file.

英文:

Is there a way available to disable viewing source, selection and right click with .htaccess file?

I have tried Googling for solutions, but could not find any reference to it thus far.

答案1

得分: 1

No。.htaccess 不是正确的工具。.htaccess 文件是服务器配置文件,它无法对用户与网站/浏览器 UI 的交互产生任何影响 - 为此,您需要使用 JavaScript。

您无法阻止用户查看网页的 HTML 源代码。(除非阻止对网页的所有访问!)

我建议避免尝试阻止“右键单击”。这只会让用户感到恼火,并提供糟糕的用户体验。用户总是可以绕过任何“右键单击”限制。

英文:

No. .htaccess is not the correct tool for the job. .htaccess files are a server configuration file, it cannot do anything to affect how a user interacts with the website/browser UI - for that you would need JavaScript.

You can't prevent the user from viewing the HTML source of the webpage. (Without blocking all access to the webpage!)

I would avoid trying to block the "right click". This will only annoy users and deliver a bad UX. The user can always circumvent any "right click" restrictions anyway.

huangapple
  • 本文由 发表于 2023年5月11日 01:45:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/76221270.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定