disable img selection

  • Thread starter Michael Chase Brazell
  • Start date
M

Michael Chase Brazell

Hi, I'm using:

document.onselectstart = new Function("return false");

to disable selection of content on my page. This works fine, except
that images are still selectable.

Any ideas?

Thanks
 
R

rf

Michael Chase Brazell said:
Hi, I'm using:

document.onselectstart = new Function("return false");

Why are you doing that?

Seems like you are trying to "protect" something from being copied. If so
your quest is doomed to failure.
 
M

Michael Chase Brazell

Why are you doing that?

Seems like you are trying to "protect" something from being copied. If so
your quest is doomed to failure.

Nope, not trying to do that... I'm writing a WebGL app and I'm using
images for labels, and it affects mouse inspection when the image
becomes highlighted.
 
G

Garrett Smith

Nope, not trying to do that... I'm writing a WebGL app and I'm using
images for labels, and it affects mouse inspection when the image
becomes highlighted.

CSS3 offers a property user-select. Mozilla browsers implement this as
-moz-user-select: text[1]. Other implementations provide similar
functionality, e.g. -webkit-user-select, etc.

For IE, the expando unselectable="on"[2].

[1] https://developer.mozilla.org/en/CSS/-moz-user-select
[2] http://msdn.microsoft.com/en-us/library/ms534706(VS.85).aspx

I've seen this question a few times. Should it be added to the FAQ?
 
M

Michael Chase Brazell

Nope, not trying to do that... I'm writing a WebGL app and I'm using
images for labels, and it affects mouse inspection when the image
becomes highlighted.

CSS3 offers a property user-select. Mozilla browsers implement this as
-moz-user-select: text[1]. Other implementations provide similar
functionality, e.g. -webkit-user-select, etc.

For IE, the expando unselectable="on"[2].

[1]https://developer.mozilla.org/en/CSS/-moz-user-select
[2]http://msdn.microsoft.com/en-us/library/ms534706(VS.85).aspx

I've seen this question a few times. Should it be added to the FAQ?

Thanks for the info, -webkit-user-select kept the image from being
highlighted with Chrome.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
474,078
Messages
2,570,570
Members
47,204
Latest member
MalorieSte

Latest Threads

Top