5

I'm just learning JavaScript right now, so please do try and explain with that detail in mind.

What I want to do is this exactly -- when a user right-clicks or uses contextmenu from keyboard, I want to know what option they selected in the contextmenu. Mainly I want to know if they selected 'paste' or not. I know that there is an onPaste event-handler but I'm looking for another approach.

1 Answer 1

4

There is no way to read the context menu from JavaScript. The best you'll be able to do is to infer the user's selection by listening to other events. That could be messy.

Sign up to request clarification or add additional context in comments.

2 Comments

is there a way to get the contents of the contextmenu.. all the various things that the contextmenu allows??
@spx - no. Not with JavaScript. You can replace the context menu with your own custom menu. Then you'll be able to read whatever you want.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.