Blogger Text

My Aim to Provide you quality contents, Tips & Tricks, Software, Microsoft Office, Graphic Editing (Adobe PhotoShop, After Affects, Illustrator, inDesign) Corel Draw, Corel Video Studio, Cyberlink PowerDirector, Power ActionCinema, Tutorials about Blogging and VU Assignments, Quizes & GDB Solutions and Much More... at regular Basis
                                     ***    Kindly Subscribe our Official YouTube Channel "INFOPALACESS OFFICIAL-Tuts: in this channel we upload Programming (C,C++,C# JAVA, PHP), Web Development, Graphics Editing and Microsoft Office Step by Step Tutorials from bigginer to Advance Level. We also provide free online courses at our YouTube Channel. ***   Graded Assignments/Quizes and GDB will start in Next Week. Solution ideas of All assignments, Quizes and GDB will be available here. If you have any problem regarding this then you can contact us.

Disable Right Click with JavaScript Disable Context Menu

Protect Your Web Contents

Disable Right Click Menu on any of your Web page

Sometimes we need to protect our contents like Text, images or our source code for our webpage to being used by others for this purpose we need to put some security on our code so that no one can use our contents without our permission.

There are many methods to protect our contents but here i am going to share simple javascript code which will disable Right Click even also disable context menu from keyboard key. To achieve just copy the following javascript code and paste it where you want to protect (e.g div, p, body) anywhere where you want.

<body oncontextmenu="return false" onselectstart="return false" ondragstart="return false">

Here in above code I applied the inline JavaScript in body, in result this will disable Rigth Context Menu for whole page. You can apply anywhere in any section if you don't want to protect whole page.

That's It. I hope like this post I you still have any confusion then let me know in comments.

Post a Comment