nsIDroppedLinkHandler 编辑

dom/base/nsIDroppedLinkHandler.idlScriptable Please add a summary to this article. 1.0 66 Introduced Gecko 2.0 Inherits from: nsISupports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)

Method overview

boolean canDropLink(in nsIDOMDragEvent aEvent, in PRBool aAllowSameDocument);
AString dropLink(in nsIDOMDragEvent aEvent, out AString aName, [optional] in boolean aDisallowInherit);
void dropLinks(in nsIDOMDragEvent aEvent, [optional] in boolean aDisallowInherit, [optional] out unsigned long aCount, [retval, array, size_is(aCount)] out nsIDroppedLinkItem aLinks);

Methods

canDropLink()

Determines if a link being dragged can be dropped.

boolean canDropLink(
  in nsIDOMDragEvent aEvent,
  in PRBool aAllowSameDocument
);
Parameters
aEvent
A dragenter or dragover event.
aAllowSameDocument
If false, drops are only allowed if the document of the source of the drag is different from the destination. This check includes any parent, sibling and child frames in the same content tree. If true, the source is not checked.
Return value

true if the link being dragged can be dropped.

Exceptions thrown
Missing Exception
Missing Description

dropLink()

Given a drop event, determines the link being dragged. If a uri is returned the caller can, for instance, load it. If null is returned, there is no valid link to be dropped.

AString dropLink(
  in nsIDOMDragEvent aEvent,
  out AString aName,
  [optional] in boolean aDisallowInherit
);
Parameters
aEvent
A drop event.
aName
The link title if it exists, or an empty string otherwise.
Return value

A uri, or null if there is no valid link to be dropped.

Exceptions thrown
NS_ERROR_DOM_SECURITY_ERR
Error will be thrown and the event canceled if the receiving target should not load the uri for security reasons. This will occur if the source of the drag initiated a link for dragging that it itself cannot access. This prevents a source document from tricking the user into a dragging a chrome url for example.

dropLinks()

Given a drop event, determines the link being dragged. If non-empty links array is returned the caller can, for instance, load it. If empty links array is returned, there is no valid link to be dropped.

void dropLinks(
  in nsIDOMDragEvent aEvent,
  [optional] in boolean aDisallowInherit,
  [optional] out unsigned long aCount,
  [retval, array, size_is(aCount)] out nsIDroppedLinkItem aLinks
);
Parameters
aEvent
A drop event.
aDisallowInherit
 
aCount
Receives the count of aLinks array
aLinks
Recives an array of objects with nsIDroppedLinkItem interface
Return value

Nothing.

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:31 次

字数:5076

最后编辑:6 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文