tenfour
tenfour

Reputation: 36896

How to control items in webkit context menu?

I am developing a webkit application for public release, and wondering how to deal with context menus.

The problem is there are items in Safari's default context menu that I don't want to show end users:

Possibly others. So, question #1 is: Is it possible to remove items selectively from the default context menu?

Another option is to create my own context menu from scratch, but then comes a host of other problems:

So the main question is in general, What should I do to preserve default functionality in Safari's context menu, while restricting certain things like "reload", "Inspect Element"?

Upvotes: 2

Views: 298

Answers (1)

ewrobinson
ewrobinson

Reputation: 351

Couldn't you use the WebUIDelegate protocol method?

- (NSArray *)webView:(WebView *)sender contextMenuItemsForElement:(NSDictionary *)element defaultMenuItems:(NSArray *)defaultMenuItems

You should be able to take the defaultItems, add the ones you want to keep to a new array, and then return said array?

Upvotes: 1

Related Questions