Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > WebView/Kit Related Questions

WebView/Kit Related Questions
Thread Tools
Grizzled Veteran
Join Date: Jun 2002
Status: Offline
Reply With Quote
Feb 27, 2004, 01:34 AM
 
Hi,

How would I do the following? Is there any sample code are delegates I haven't found (looked, but probably missed something).

1: How do I go about turning off all contextual menu's in a WebView?
2: How do I go about not allowing any urls to be clicked? Thus stopping a user from traveling outside the set page.

Thanks
     
Fresh-Faced Recruit
Join Date: Feb 2004
Location: UK
Status: Offline
Reply With Quote
Feb 27, 2004, 03:52 AM
 
Got this code from a friend...

- (NSArray *)webViewWebView * )sender contextMenuItemsForElementNSDictionary *)element defaultMenuItemsNSArray * )defaultMenuItems
{
NSMutableArray *modifiedMenuItems = [NSMutableArray arrayWithArray:defaultMenuItems];
NSMenuItem *item;

int i = 0;
while(i < [modifiedMenuItems count]) {

item = [modifiedMenuItems objectAtIndex:i];

switch([item tag]) {
case WebMenuItemTagOpenLinkInNewWindow :
case WebMenuItemTagDownloadLinkToDisk :
case WebMenuItemTagCopyLinkToClipboard :
case WebMenuItemTagOpenImageInNewWindow :
case WebMenuItemTagDownloadImageToDisk :
// case WebMenuItemTagCopyImageToClipboard :
case WebMenuItemTagOpenFrameInNewWindow :
// case WebMenuItemTagCopy :
[modifiedMenuItems removeObject:item];
break;
default:
i++;
break;
}
}

return (modifiedMenuItems);
}
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 08:58 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2