Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IE Context Menu Edit

Status
Not open for further replies.

wilky27

Programmer
Aug 22, 2003
9
GB
Hello,

Ok, I'm looking to remove the 'save target as' and 'print' features of the IE context menu for selected pages on my site. Im not using browser control which may be a problem. Any suggestions much appreciated!

Thanks in advance.

Wilky.
 
May I ask why?

I don't believe it is possible, even if it were it would be easy to bypass.

Just something to think about before you spend hours writing some fantastic security system and then some 12 yr old comes along with javascript disabled and steals your site.
 
The reason I want to do this is my page contains a list of .lpw file which are files created by the company I work for. When one of these files are clicked the link starts with formx instead of http:, which fires a program to view these files. Now when you right click and 'save target as' it fires an error, hence I want to disable 'save target as'. I can create my own oncontextmenu I suppose, but this would be alot of work and I'm not to clever in JS.

Thanks,
Wilky.
 
All I can suggest is disabling right click, but it aint that robust


document.oncontextmenu=new Function("return false")

 
This is an option, but I need other features, such as 'copy shortcut' etc..

Thanks
 
do you have control over the viewing browser?

if so then disable the menu items like this

In Internet Explorer, click Internet Options on the Tools menu.
Click the Content tab.
Under Content Advisor, click Enable.

this should disable save target as and print options
 
Unfortunatly not, but thanks anyway!

Think something im looking along the lines of something like this:

<html>
<head>
<title>FAQTS - Juergen Thelen - Trap Save Target as (IE5/NN4)</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
#Blk1 { position: absolute; top: 10; left: 10 }
</style>
<script language="JavaScript1.2">
<!--

function TrapRight(e)
{
if (e.which == 3) return false;
}

function Init()
{
if (document.layers)
{
document.layers.Blk1.captureEvents(Event.MOUSEDOWN);
document.layers.Blk1.onmousedown = TrapRight;
}
}
//-->
</script>
</head>

<body bgcolor="#FFFFFF" onLoad="Init()">
<div id="Blk1"> <a href="dummy.htm"><img src="whatever.gif" width="20"
height="20" border="0" oncontextmenu="window.focus(); return
false"></a>
</div>
</body>
</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top