Disable Context Menu through a behavior

Y

YBOTI

I am attempting to use a css behavior to disable or change the context
menu for images, via the oncontectmenu event.

I have no trouble getting my custom action to work (a simple alert()
box), but after that, the context menu still comes up. My objective is
to do this without having to tag each image with a "return false" as
in the javascript method, and in this instance I would like to avoid
imbedding a javascript in the code.

Is there a way to do this within the construct of the behavior defined
in an attached script in the .htc file, or am I stuck tagging my
images?
 
S

Stefan B Rusynko

If your goal is to disable right click see
http://www.xslt.com/xsl-list/2002-03/msg00799.html

IMHO
- you are wasting your time and probably going to offend most educated users (or impaired users), and not stop any determined users
for saving your images or viewing source
See http://www.jimcoaddins.com/protect.htm



| I am attempting to use a css behavior to disable or change the context
| menu for images, via the oncontectmenu event.
|
| I have no trouble getting my custom action to work (a simple alert()
| box), but after that, the context menu still comes up. My objective is
| to do this without having to tag each image with a "return false" as
| in the javascript method, and in this instance I would like to avoid
| imbedding a javascript in the code.
|
| Is there a way to do this within the construct of the behavior defined
| in an attached script in the .htc file, or am I stuck tagging my
| images?
|
|
 
Y

YBOTI

I do sincerly appeciate the advice and comments. I surely do not mean to or
intend to offend anyone, but I would question that group who would be so
offended at someone doing the eqivelent of locking their front door or
adding "nospam" to one's email address!

And while for the time I would grant the author of Jimco his arguments (in
the interest of time and intent), I would equally argue that my client's
copyrighted images are intellectual property worthy of whatever protection
may be technically afforded. But that is a discussion for an intellectual
property group. So to that end, and with more respect to my clients
requirements than to the easily offended savy user, I direct attention back
to my original question.

My original point was I wanted to achieve the objective (disable or replace
the context menu, or the default right-click action) via a behavior attached
to an object's event rather than through an imbeded javascript. And while I
know well how to do this with a javascript, I have specific reasons for
wanting to avoid that technical approach if I can.

I am attempting to use a css file to implement a behavior. I have been
successful at it except for one small point. After my custom action is
complete the context menu still comes up. It performs my custom action, then
procedes with the default action. I am wondering if someone more experienced
than I in DHTML implementations might tell me, is it possible to actually
replace the context menu action this way without employing anything else, OR
are such behaviors, by design, only an augmentation of a default behavior,
not a replacement.

With humble thanks ...

Stefan B Rusynko said:
If your goal is to disable right click see
http://www.xslt.com/xsl-list/2002-03/msg00799.html

IMHO
- you are wasting your time and probably going to offend most educated
users (or impaired users), and not stop any determined users
 
Y

YBOTI

Thank you, Steve.

I appreciate everyones' efforts.

Yes. I know, and my client knows, that, as in my example of locking the
front door, there are no guarantees. Yet, we still lock the front door.

I am in great hopes someone can simply answer what I see as a technical
question, unencumbered with the philosophical arguments.

While I appreciate your efforts, again, they ignore (though I am sure not
intentionally) my point. These are 4 fine examples of how to do it with
JavaScript. I am not looking for a JavaScript solution.

I am specifically asking about a DHTML behavior type solution. This solution
would not involve assigning an oncontectmenu anywhere within the context of
the web page. That is specifically what I am trying to avoid.

In a cascading style sheet I have assigned a behavior URL to IMG objects. In
the file referred to by the url I have a custom action.

When I right click my image the custom action takes place as expected. When
I click "OK", the context menu comes up.

Is it technically possible with this type implementation, and without adding
JavaScript or an oncontectmenu statement within the flow of the html to get
the default action to not happen?

If, in someone's experience they know this to be possible or not possible,
or if they are aware of documents specifically geared to this type solution
as opposed to a JavaScript implementation, I would appreciate hearing from
them.
 
J

Jim Cheshire

Hi YBOTI,

Please understand that my point was not that your client's images are not
intellectual property. My point was that HTML is not intellectual property.
HTML is a layout language. It does not implement any particular
functionality and is not intellectual property. I am absolutely not
offended by your efforts to protect your intellectual property. On the
contrary, I strongly advise it, but I think you should be thoroughly
educated in the techniques that will afford you the greatest chance of
success in doing so.

Images are intellectual property, and it's vitally important that all Web
developers understand the futility of using the common techniques of
"protecting" them. In my article, I pointed out your number one resource
for protecting your intellectual property; digital watermarking. I strongly
advise that you check out the services Digimarc offers. It is the best way
to protect images in my opinion.



--
Jim Cheshire
Jimco Add-ins
http://www.jimcoaddins.com
===================================
Co-author of Special Edition
Using Microsoft FrontPage 2003
Order it today!
http://sefp2003.frontpagelink.com
 

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

Top