By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
460,044 Members | 1,192 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 460,044 IT Pros & Developers. It's quick & easy.

disable context menu bar in browser

P: n/a
I want to disable context menu bar in browser, and I do the following
by copying a code in net, it is working though, but I just don't
understand what is new Function here means, can anyone advise?
thanks!!

document.onselectstart=new Function ("return false");
Jul 23 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
In article <ba**************************@posting.google.com >,
jr********@hotmail.com enlightened us with...
I want to disable context menu bar in browser, and I do the following
by copying a code in net, it is working though, but I just don't
understand what is new Function here means, can anyone advise?
thanks!!

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

It just reassigns the event a new handler that does nothing at all, basically
cancelling the event. I don't think it's cross-browser.

Disclaimer / my 2 cents: In the vast majority of cases, doing what you're
doing is at best a Bad Idea and at worst illegal (UK internet accessibility
law). Most people reassign the context menu to try to keep people from
stealing things. That's so ineffective, it's laughable, and it irritates
legit users. The only reason you should be re-assigning the context menu is
to provide a better one for an intranet application. Since I don't know what
you're doing, this comment should be taken in general, not specific to you,
so don't get your panties in a wad. ;)

HTH

--
--
~kaeli~
If a book about failures doesn't sell, is it a success?
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.