473,320 Members | 1,854 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

how to implement oncontextmenu="return false;" to pass the W3C parser ?

me
I have got all my pages to comply with the W3C validator, except this
one line as below.

I need to keep the line (or the functionalilty) but it would be nice
to implement it in a way that gives me a 100% pass with W3C.

Any ideas?

Thanks.
Line 45, column 33: there is no attribute "ONCONTEXTMENU"

<body class="body" oncontextmenu="return false;">

You have used the attribute named above in your document, but the
document type you are using does not support that attribute for this
element. This error is often caused by incorrect use of the "Strict"
document type with a document that uses frames (e.g. you must use the
"Transitional" document type to get the "target" attribute), or by
using vendor proprietary extensions such as "marginheight" (this is
usually fixed by using CSS to achieve the desired effect instead).

This error may also result if the element itself is not supported in
the document type you are using, as an undefined element will have no
supported attributes; in this case, see the element-undefined error
message for further information.

How to fix: check the spelling and case of the element and attribute,
(Remember XHTML is all lower-case) and/or check that they are both
allowed in the chosen document type, and/or use CSS instead of this
attribute.
Jul 23 '05 #1
11 43936
In comp.infosystems.www.authoring.html me said:
I have got all my pages


i know

What is the accepted way to share a message across multiple newsgroups?
http://smjg.port5.com/faqs/usenet/xpost.html

--
t h e o f l i t t l e v o i c e s
Jul 23 '05 #2
rf
me wrote:
I have got all my pages to comply with the W3C validator, except this
one line as below.


Why do you want to cripple my browser so I can't use the context menu to,
for instance, bookmark your site?

You don't by any change think that this tomfoolery will prevent me from
stealing your precious HTML do you?

--
Cheers
Richard.
Jul 23 '05 #3
me wrote:
I have got all my pages to comply with the W3C validator, except this
one line as below.

I need to keep the line (or the functionalilty) but it would be nice
to implement it in a way that gives me a 100% pass with W3C. <body class="body" oncontextmenu="return false;">


Use Javascript's addEventListener function to attach the event to the
body element.

--
Mark.
http://tranchant.plus.com/
Jul 23 '05 #4
me wrote:
I have got all my pages to comply with the W3C validator, except this
one line as below.

I need to keep the line (or the functionalilty) but it would be nice
to implement it in a way that gives me a 100% pass with W3C.


....but disabling the context menu is stupid.

--
Mark.
http://tranchant.plus.com/
Jul 23 '05 #5
me <me@no.where.com> wrote:
I have got all my pages to comply with the W3C validator, except this
one line as below.

I need to keep the line (or the functionalilty) but it would be nice
to implement it in a way that gives me a 100% pass with W3C.

Any ideas?

Thanks.
Line 45, column 33: there is no attribute "ONCONTEXTMENU"

<body class="body" oncontextmenu="return false;">


This is a Microsoft IE extension. There is no mechanism in the
standards for intercepting the opening of a context menu. Therefore,
there is no way to do so that will pass the validator.

If you feel you must be able to disable your users' context menus,
then you're in trouble because you can only do that to IE users. Users
of other browsers will be able to access their context menus just
fine.

--
Harlan Messinger
Remove the first dot from my e-mail address.
Veuillez ôter le premier point de mon adresse de courriel.
Jul 23 '05 #6

"Mark Tranchant" <ma**@tranchant.plus.com> wrote in message
news:41***********************@ptn-nntp-reader02.plus.net...
me wrote:
I have got all my pages to comply with the W3C validator, except this
one line as below.

I need to keep the line (or the functionalilty) but it would be nice
to implement it in a way that gives me a 100% pass with W3C.

<body class="body" oncontextmenu="return false;">


Use Javascript's addEventListener function to attach the event to the
body element.


Is that a Javascript function? IE doesn't have it. It does have
attachEvent--but the IE documentation indicates that *that* is non-standard.
Yeah, the OP will get by the validator--but outside of IE he still won't get
what he wants.

Jul 23 '05 #7
On Mon, 01 Nov 2004 12:08:43 +0000, me <me@no.where.com> wrote:
I have got all my pages to comply with the W3C validator, except this
one line as below.


Don't use a Strict DTD unless you understand every error report from a
validator.

If you do, and you don't, then try revalidating it with a Transitional
DTD.

If it still won't validate, then take out the non-standard HTML
extensions that you're using, despite the very clear and obvious error
report you've been given.

And _NEVER_ turn off the whole context menu. That kills image
reloading, printing, and a whole pile of useful things as well as
whatever it was you thought you were doing. If you're paranoid about
content theft, then you need to be better about it; more secure, and
less irritating.

--
Smert' spamionam
Jul 23 '05 #8
On Mon, 1 Nov 2004 09:59:17 -0500, Harlan Messinger
<h.*********@comcast.net> wrote:
"Mark Tranchant" <ma**@tranchant.plus.com> wrote in message
news:41***********************@ptn-nntp-reader02.plus.net...
[snip]
Use Javascript's addEventListener function to attach the event to the
body element.


Is that a Javascript function?


Yes and no. It's a method exposed to ECMAScript implementations, but it's
defined by the W3C in DOM 2 Events.
IE doesn't have it.
No, as IE doesn't implement the Events module.
It does have attachEvent
A rather annoying thing to use. In event listeners added through HTML, the
on<event> properties of the element, or addEventListener in conforming
browsers, the this operator refers to the current target of the event.

Though that's fine in IE, event listeners added through attachEvent do not
have a correctly set this operator. In fact, it refers the global object
(window).

[snip]
Yeah, the OP will get by the validator--but outside of IE he still won't
getwhat he wants.


document.oncontextmenu = function() {return false;};

Depending on your point of view, that will, or will not, still produce an
invalid document tree, but it will pass the validator. I don't condone it
in either case, by the way.

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #9
On Mon, 01 Nov 2004 15:01:34 +0000, Andy Dingley <di*****@codesmiths.com>
wrote:
On Mon, 01 Nov 2004 12:08:43 +0000, me <me@no.where.com> wrote:
I have got all my pages to comply with the W3C validator, except this
one line as below.


Don't use a Strict DTD unless you understand every error report from a
validator.


How else can you learn every error report?
Jul 23 '05 #10

"Michael Winter" <M.******@blueyonder.co.invalid> wrote in message
news:opsgslbzemx13kvk@atlantis...
On Mon, 1 Nov 2004 09:59:17 -0500, Harlan Messinger
<h.*********@comcast.net> wrote:
Yeah, the OP will get by the validator--but outside of IE he still won't
getwhat he wants.


document.oncontextmenu = function() {return false;};

Depending on your point of view, that will, or will not, still produce an
invalid document tree, but it will pass the validator. I don't condone it
in either case, by the way.


Just to make it clear to the OP--your statement will add a method to the
document object called "oncontextmenu", but in most browsers it will sit
there, inert, just as if you had written

document.iservenopurpose = function() { return false; };

Jul 23 '05 #11
On Mon, 1 Nov 2004 09:59:17 -0500, Harlan Messinger
<h.*********@comcast.net> declared in
comp.infosystems.www.authoring.html:
Yeah, the OP will get by the validator--but outside of IE he still won't get
what he wants.


Just as well really. And most non-IE browsers have the option to block
disabling of the context menu anyway.

--
Mark Parnell
http://www.clarkecomputers.com.au
Jul 23 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Arvid Andersson | last post by:
Hello, I need to convert a string to a number, but the string can contain +,-,* and / as well as parenthesis. For example, if I have the string "30/(6+9)" I would like a function that returned the...
1
by: ItsMillerTime4u | last post by:
I'm trying to change the <body> 's event oncontextmenu attributes, but am having no luck at it. I know I can do <body oncontextmenu="contextMenu(); return false;"> but the thing is that I set's...
8
by: Ken Yu | last post by:
Hi, How can i disable "RightClick Menu" in Internet Explorer, when access the frontpage ? tks a lot ! Ken
15
by: Cruella DeVille | last post by:
I'm trying to implement a bookmark-url program, which accepts user input and puts the strings in a dictionary. Somehow I'm not able to iterate myDictionary of type Dict{} When I write print...
40
by: Mark P | last post by:
I'm implementing an algorithm and the computational flow is a somewhat deep. That is, fcn A makes many calls to fcn B which makes many calls to fcn C, and so on. The return value of the outermost...
37
by: jht5945 | last post by:
For example I wrote a function: function Func() { // do something } we can call it like: var obj = new Func(); // call it as a constructor or var result = Func(); // call it as...
4
by: Luc The Perverse | last post by:
Hi - I have very little C# programming experience. I am making a software product which calls for an interface almost identical to Windows Explorer - and I wondered if mounting a "virtual drive"...
3
by: Mark Shroyer | last post by:
I guess this sort of falls under the "shameless plug" category, but here it is: Recently I used a custom metaclass in a Python program I've been working on, and I ended up doing a sort of write-up...
29
by: Java script Dude | last post by:
Greetings, Now I can understand that 0 equal false, but should "" also equal false? Apparently the answer is yes. When I test both Firefox and IE, they both say ""==false . I assume this goes...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.