Custom Context Menu with Javascript?

匆匆过客 提交于 2019-12-07 17:09:45

问题


Is there a way to add custom fields to the built in browser context menu using Javascript?

I know flash/actionscript can do this, how are they doing it? Example: right click on http://josephjewell.com and see the custom context menu.

Is this possible with pure javascript or do you have to use flash?

Note, I'm looking for adding to the built in browser context menu, not using custom javascript popups to mimic them.


回答1:


Is this possible with pure javascript

No.

do you have to use flash?

Well, you can use Flash, but then you're not adding to the browser menu, you're replacing it completely with Flash's one. So this doesn't get you much that the scripted ersatz-menu doesn't (really only that you get the proper OS theme for menus by default).

In any case even JS ersatz-menus are not reliable, as not all browsers will always let you remove the browser default menu. It is best not to rely on scripting right-click menus.




回答2:


Is this possible with pure javascript or do you have to use flash?

As far as I know, to customize the browser menu, registry keys are are created in the registry there by adding more to browser context menu. Flash can create keys in the registry.

On the other hand, browsers such as Mozilla Firefox have their browser-specific API allowing you to customize the context menu as you have seen with many addons out there.

So, you can not do that with pure javascript.



来源:https://stackoverflow.com/questions/3027805/custom-context-menu-with-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!