BeWebmaster

Disable Right Click using Dreamweaver MX 2004

Ad

Dreamweaver MX 2004 code snippets feature includes a JavaScript code to disable right click on your website.

Open the page you want right-click disabled on and in code view place the cursor between the head tags of the html document.

We will continue by inserting a JavaScript object in our document. We can do it by typing the code in, or by using Dreamweaver MX 2004 Insert Bar. In the Insert bar which contains buttons for inserting various types of "objects," such as images, tables, and layers, into a document, click on the down arrow, select HTML and click the Script button.

In the Script dialog window make sure “JavaScript” is selected and leaving other fields empty click “OK”. Place the cursor just before the </script> tag and hit enter.

You should have the code similar to the image below.

Making sure that your cursor is between the script tags, locate and expand the Code tab in the right pane.

Select Snippet tab, expand the folders JavaScript -> browser functions and double-click on Disable Right Click

The function that disables the right-click is written to your document.

The script displays an alert “Right click disabled” every time the visitor right-clicks on the page. If you do not want to display any massages comment out following lines by typing double slash “//” in front of them:

//var message = "Right click disabled";

And two occurrences of:

// alert(message);