I used rightclick handler with openlayers2 and now I am upgrading my website to openlayers3 and I cannot find this handler in ol3


1 Answer 1


Just repeating/summarizing some other answers. You can add your own listener on viewport:

map.getViewport().addEventListener('contextmenu', function (evt) {


Or use an extension I've written to address this feature - https://github.com/jonataswalker/ol3-contextmenu - jsFiddle demo.

See https://stackoverflow.com/a/32246757/4640499.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.