Join MDN and developers like you at Mozilla's View Source conference, 12-14 September in Berlin, Germany. Learn more at https://viewsourceconf.org

nsIDroppedLinkHandler

Please add a summary to this article.
1.0
28
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);

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
);
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.

Document Tags and Contributors

 Contributors to this page: Sheppy, trevorh
 Last updated by: Sheppy,