英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论