How to disable the 'Open Link in New Tab' in the browser?

前端 未结 4 1644
攒了一身酷
攒了一身酷 2021-02-05 16:16

How do I disable/remove the \'Open Link in New Tab\' option in the right-click menu of the browser? If this is not possible with javascript etc then is there a way to modify wh

4条回答
  •  执念已碎
    2021-02-05 17:10

    I am not sure why would some one downvote your question, what you need to google is how to hijack events using javascript. You can very well show an alert when you click a link and stop it from working. jQuery is a populat JS toolkit and has a method to stop default events on an element, in plain English, using jQuery you can stop a hyperlink from working it and show an alert as well. This link http://api.jquery.com/event.preventDefault/ can help you further. Regarding disabling the context menu that appears on right clicking on a webpage, yes that is very much possible. I am not a JS ninja so can't comment if you can remove an item from context menu but IMO, it should not be possible.

提交回复
热议问题