Solved

disable ability to highlight text in ie

Posted on 2001-06-04
9
249 Views
Last Modified: 2008-03-06
Hi,

Does anyone know if there is a way to disable the user from highlighting text while using an instance of the ie?

Thanks ,
Chris
0
Comment
Question by:chrisshebib
  • 6
  • 3
9 Comments
 
LVL 19

Expert Comment

by:cheekycj
ID: 6156364
<SCRIPT LANGUAGE="JavaScript1.2"><!--
function disableSelect() {
   if (navigator.appName=="Netscape")
        window.find(' ');
   else if (navigator.appName == "Microsoft Internet Explorer")
        document.selection.empty();
   else
       return true;   // do something else if you want
    return false;
}

document.onMouseDown = disableSelect;
//--></SCRIPT>

HTH,
CJ
0
 

Author Comment

by:chrisshebib
ID: 6156892
CJ,

I tried this but it had no effect - I'm using IE 5.5 with SP1.

Here is the code that I'm testing with:

<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head>
<SCRIPT LANGUAGE="JavaScript1.2">
<!--
function disableSelect()
{  
     if (navigator.appName=="Netscape")      
     {
          window.find(' ');  
     }
     else if (navigator.appName == "Microsoft Internet Explorer")      
     {
          alert("MSIE");
          document.selection.empty();  
     }
     else      
     {
          return true;
     }
       
     // do something else if you want  
     return false;
}

document.onMouseDown = disableSelect;
//-->
</SCRIPT>

<body onload="disableSelect();">

<p>Here is some sample text</p>

</body>

</html>


Thanks,

Chris
0
 
LVL 19

Expert Comment

by:cheekycj
ID: 6157119
The code is supposed to work for NS4 and IE4.. I am not sure about IE 5.5
0
 

Author Comment

by:chrisshebib
ID: 6157232
Ok, thanks for you help anyway.

Chris
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:chrisshebib
ID: 6157306
Ok, thanks for you help anyway.

Chris
0
 
LVL 19

Accepted Solution

by:
cheekycj earned 50 total points
ID: 6157419
0
 

Author Comment

by:chrisshebib
ID: 6157500
Ah, that did the trick.
 
Thanks very much.

Chris
0
 

Author Comment

by:chrisshebib
ID: 6157570
Ah, that did the trick.
 
Thanks very much.

Chris
0
 

Author Comment

by:chrisshebib
ID: 6157572
That did the trick!

Thanks very much,
Chris
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Accessibility and Usability are two concepts that seem to be closely related.  But, too many people seem to have a distorted perception of them. During last five years, those two words have come to the day-to-day work of almost every web develope…
Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

943 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now