Solved

disable ability to highlight text in ie

Posted on 2001-06-04
9
248 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
Comment Utility
<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
Comment Utility
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
Comment Utility
The code is supposed to work for NS4 and IE4.. I am not sure about IE 5.5
0
 

Author Comment

by:chrisshebib
Comment Utility
Ok, thanks for you help anyway.

Chris
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

Author Comment

by:chrisshebib
Comment Utility
Ok, thanks for you help anyway.

Chris
0
 
LVL 19

Accepted Solution

by:
cheekycj earned 50 total points
Comment Utility
0
 

Author Comment

by:chrisshebib
Comment Utility
Ah, that did the trick.
 
Thanks very much.

Chris
0
 

Author Comment

by:chrisshebib
Comment Utility
Ah, that did the trick.
 
Thanks very much.

Chris
0
 

Author Comment

by:chrisshebib
Comment Utility
That did the trick!

Thanks very much,
Chris
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

772 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

10 Experts available now in Live!

Get 1:1 Help Now