For images that are not also links, the following code will register the URL from which the image was dragged. This works for me in Safari and Firefox.
@implementation DragView
- (void)awakeFromNib {
[self registerForDraggedTypes:[NSArray arrayWithObject:NSURLPboardType]];
}
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender {
return NSDragOperationCopy;
}
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender {
NSPasteboard *pboard;
pboard = [sender draggingPasteboard];
NSLog(@"types: %@", [pboard types]);
NSLog(@"url: %@", [NSURL URLFromPasteboard:pboard]);
return YES;
}
@end
, URL- href . URL- "" ( "Finder Get Info" ) kMDItemWhereFroms .