是否可以知道通过 AppleScript 事件收到的 GURL 调用的引荐来源网址?
我有一个与我的 Cocoa 应用程序关联的协议处理程序。
[[NSAppleEventManager sharedAppleEventManager]
setEventHandler:self
andSelector:@selector(getUrl:withReplyEvent:)
forEventClass:kInternetEventClass andEventID:kAEGetURL];
...
- (void)getUrl:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent
{
#ifdef DEBUG
NSLog(@"%s: %@",__PRETTY_FUNCTION__,event);
#endif
NSURL *url = [NSURL URLWithString:[[event paramDescriptorForKeyword:keyDirectObject] stringValue]];
...
}
谁是推荐人? (如果它从本地计算机调用,我认为它可能是未定义的,但如果我调用 来自网站的该协议...我想知道接收请求的域。
有可能吗?
是否有通过其他方式解决此任务的解决方案?
I have a protocol handler associated with my Cocoa application.
[[NSAppleEventManager sharedAppleEventManager]
setEventHandler:self
andSelector:@selector(getUrl:withReplyEvent:)
forEventClass:kInternetEventClass andEventID:kAEGetURL];
...
- (void)getUrl:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent
{
#ifdef DEBUG
NSLog(@"%s: %@",__PRETTY_FUNCTION__,event);
#endif
NSURL *url = [NSURL URLWithString:[[event paramDescriptorForKeyword:keyDirectObject] stringValue]];
...
}
Who is referrer? (if it called from local machine I think it can be undefined, but if I call
this protocol from a Web site... I would like to know domain from which the request is received.
Is it possible at all?
Is there solution to solve this task by another way?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试检查回复事件的目标。该事件将被发送回向您发送原始事件的任何应用程序,无论它位于何处。
如果您的意思是用户正在单击应用程序处理的链接,并且您想知道包含该链接的页面的 URL:则无法做到这一点。
Try inspecting the target of the reply event. That event will be sent back to whatever application sent you the original event, wherever it may be.
If you mean the user is clicking on a link that your application handles, and you want to know the URL of the page that contained the link: There's no way to do that.
从:
http://www.cocoabuilder.com/archive/cocoa/125741-finding-the-sender-of-an-appleevent-in-cocoa-app-on-10-2- 8-或-更大.html
From:
http://www.cocoabuilder.com/archive/cocoa/125741-finding-the-sender-of-an-appleevent-in-cocoa-app-on-10-2-8-or-greater.html