Javascript + css disables right-clicking and selecting webpage text

Source: Internet
Author: User

I have mentioned several articles about right-click prohibition. The related code is lengthy and not concise enough. In this article, let's look at a simple implementation code of js + css, right-click is prohibited and text on the selected webpage is prohibited. The firefoxfirefox browser is supported.

CSS code:

Body {-moz-user-select: none; hutia: expression (this. onselectstart = function () {return (false )});}

JavaScript code:

<Script language = "JavaScript"> document. oncontextmenu = function (e) {return false ;}</script>

Note: JavaScript code and CSS code are indispensable. This Code supports the Firefox browser.

Related Tutorials:

Right-click prohibited in javascript, copy prohibited, and paste prohibited

Prohibit the right-click menu on the webpage and prevent copying content from saving the webpage

Do not use the right-click code on an image

Analysis and code overview of webpage shielding right-click

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.