• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 875
  • Last Modified:

make html text non selectable

Hi there,
Is there a way to make part of the text on my html page non selectable?
0
ioustinos_sarris
Asked:
ioustinos_sarris
  • 3
  • 3
1 Solution
 
torimarCommented:
The only way that I could think of is to create an image with the text in question and then insert the image into your page instead of html text.

0
 
torimarCommented:
A long while ago, javasripts were quite fashionable that disabled the right mouse button on a web page (like this one, for instance: http://www.dynamicdrive.com/dynamicindex9/noright.htm).

Theoretically, one could modify the script to prevent the left mouse button from being clicked. BUT:
- users might still select text with the cursor keys
- javascript can easily be turned off
- I don't think those scripts still work with new generation browsers


So, I'm left with my above mentioned suggestion.
Alternatively, you could try to place a transparent image in a <div> layer (http://www.echoecho.com/csslayers.htm) right on top of the text. So when the visitor wishes to select the text underneath, all he gets is the image. But I'd expect this to require a lot of fiddling.
0
 
GawaiCommented:
There is a way to overcome

if u disable right click, u can select the text, below site will help u out
ref
http://www.dynamicdrive.com/dynamicindex9/noselect.htm

or just try this

<body onselectstart = return false; >

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Tony McCreathTechnical SEO ConsultantCommented:
Placing a div over the top of the text would stop selection.
0
 
GawaiCommented:
the link i gave u does extacly wat u wanted
0
 
torimarCommented:
gawai,

the link you gave indeed does what the OP wants, but the method itself suffers from the same disadvantage I mentioned above: it is Javascript dependent, and Javascript may be disabled in no time.

For instance: the link you gave also offers a demonstration of how the script works. I went there with my standard Opera browser, realized I couldn't select text, pressed F12, turned off Javascript, reloaded the page and selected the text. This took me about 4 seconds.
I then pasted the link into my Firefox browser which runs the No-Script extension by default, and I could select the text rightaway.

Hence: protecting your content with Javascript is like no protection at all.
0
 
GawaiCommented:
then the best method is to use flash
load the text dynamically in flash MC.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now