Forum Moderators: open

Message Too Old, No Replies

Open Browser

         

yllai

7:42 am on Apr 19, 2004 (gmt 0)

10+ Year Member



Below is the script in my page that will open a new browser when user click on the hyperlink,

<head>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
</head>

<body>
<a href="javascript:;" onClick="MM_openBrWindow('battery.jpg','Page2','width=500,height=500')">Click Image</a>&nbsp;(Right click)<br><br>
</body>

However, I want to add the script in <head> as below for disable right click on the new open browser,

<SCRIPT language=JavaScript>
var message = "function disabled";
function rtclickcheck(keyp){
if (navigator.appName == "Netscape" && keyp.which == 3){ alert(message); return false; }
if (navigator.appVersion.indexOf("MSIE")!= -1 && event.button == 2) { alert(message); return false; } }
document.onmousedown = rtclickcheck;
</SCRIPT>

The problem is how I include the function rtclickcheck()in the new open browser?

dcrombie

8:53 am on Apr 20, 2004 (gmt 0)



As you're doing it - opening the JPEG file directly - you can't. You would need to open an HTML file that includes the JPEG file as well as the relevant JavaScript.

This won't stop anyone copying your images however as there are many many ways to get around it. Mac users for example don't even have a right-mouse button but can still copy images ;)