Drag an image from Explorer to an Iframe

Posted on 2005-04-15
Last Modified: 2008-03-04
I want to drag an image from Explorer (Windows Explorer) to an Iframe or other suitable container in IE.

I can drag an image from one instance of IE to an IFrame in another (security permissions for drag and drop are enabled) OK, and do the same between two instances of Firefox. I can also drag from Explorer to an Iframe in Firefox.

But if I drag from Explorer to an Iframe in IE, I get no insertion caret and the page just navigates away and shows the image full screen. It seesm to me I should be able to intercept the URL of the dragged image somehow such that it is displayed where I want it in the Iframe.

I actually need that URL anyway (whether from another instance or from Explorer) because I want to save the information in a form submit.

Can anyone help?


Question by:Mutley2003
    LVL 63

    Accepted Solution

    Read this and tell me how it is working for you:

    My example is not working:
    <body onDragEnter="return false" onDragOver="return false" onDrop="alert(event.dataTransfer.getData('Text'))">


    Author Comment

    Thanks for the reference .. the example you gave always gives me "Null"  in the alert.

    the getData method for the DataTransfer object says

    "The getData method enforces cross-frame security and allows data transfers within the same domain only. To the user this means that dragging a selection between different security protocols, such as HTTP and HTTPS, will fail. In addition, dragging a selection between two instances of the browser with different security levels, where the first instance is set to medium and the second is set to high, will fail. Finally, dragging a selection into the browser from another drag-enabled application, such as Microsoft Word, also will fail."

    However, I can most certainly drag selected text from Word into an Iframe , although it acts like a cut operation if the receiver is IE, not if the receiveris Firefox.

    Surely it is possible to intercept that URL somehow .. whatever the javascript equivalent is OnBeforeNavigate?

    The URL must be on the clipboard somewhere, otherwise the browser would not accept it and navigate to it.

    Still searching here.

    LVL 75

    Assisted Solution

    by:Michel Plungjan
    I am almost certain you cannot.
    I have not seen a dropped url or anything do anything in a frame in IE from outside

    Author Comment

    I think you are correct Michel .. I am certainly not encouraged by what I have read or by the experiments, and I think the security model is the key.


    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    Suggested Solutions

    Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
    I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
    The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
    The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

    731 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now