|
-
Apr 26th, 2006, 12:20 PM
#1
Thread Starter
Member
Frontpage - right click viewing
I'm looking for code that will not only prevent right click viewing of sourcecode, but send a popup saying that it has been disabled and why. I know frontpage (or other html editors) don't show up very often but it is part of the office suite and I'm kinda stumped.
Any help or tricks gladly appreciated.
-
May 4th, 2006, 09:23 PM
#2
Re: Frontpage - right click viewing
There are two methods for turning off (disabling) right-click functionality in a browser.
NOTE: You may receive an error message if you copy and paste the examples directly from this article into FrontPage. The angle brackets ("<" and ">") may appear as escaped HTML code ("<" and ">"). To work around this behavior, paste the script in a blank Notepad document, and then copy it from Notepad before you paste it into FrontPage.
WAY ONE: Turn Off the Shortcut Menu
1. Open a new page in FrontPage.
2. Switch to HTML view.
3. Locate the opening <BODY> tag.
4. Modify the <BODY> tag to resemble the following:<body onContextMenu="return false">
5. Preview the page in Internet Explorer 5.0 or later. When you attempt to right-click anywhere on the page, the shortcut menu is not displayed.
WAY TWO2: Use JavaScript to Display a Warning Message
1. Open a new page in FrontPage.
2. On the Insert menu, click Advanced.
3. Select HTML.
4. Type the following JavaScript code into the HTML Markup box:<script language="JavaScript">
var message = "Sorry, that function is disabled.\n\n";
message += "This page is copyrighted, and ";
message += "all content is protected.";
function click(e) {
if (document.all) {
if (event.button == 2) {
alert(message);
return false;
}
}
if (document.layers) {
if (e.which == 3) {
alert(message);
return false;
}
}
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown=click;
</script>
5. Click OK.
6. Preview the page in Internet Explorer 5.0 or later. When you attempt to right-click anywhere on the page, a message box appears, stating that the contents of the page are copyrighted, and therefore the right-click function is turned off (disabled).
hope this helps...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|