Drag an image from Explorer to an Iframe

Posted on 2005-04-15
Medium Priority
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
  • 2
LVL 63

Accepted Solution

Zvonko earned 1600 total points
ID: 13797709
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

ID: 13799644
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
Michel Plungjan earned 400 total points
ID: 13800820
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

ID: 13803010
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
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…
Suggested Courses

755 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