Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8279439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:20:32+00:00 2026-06-08T09:20:32+00:00

The document.ondrop seems to work in chrome, but not in firefox? Attached is an

  • 0

The document.ondrop seems to work in chrome, but not in firefox?

Attached is an example:
http://auth.letschat.info/test2.php

If you drop a file on to the page it should pop up an alert box. However it doesn’t work in firefox, but does in chrome.

When I use firefox console the document.ondrop handler is correctly set.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T09:20:35+00:00Added an answer on June 8, 2026 at 9:20 am

    Assuming the original javascript looks like this and works in Chrome:

    document.ondrop=function(event){
        alert("hello");
    }
    

    It can be changed to work in both Firefox and Chrome. Firefox requires you to stop the default action from occuring when you drag a file over, which can be solved by using the ondragover event. The following javascript code will also work in Firefox:

    document.ondragover = function(event){
        event.preventDefault();
    }
    document.ondrop=function(event){
        alert("hello");
    }
    

    I found this solution by looking at w3schools and looking for the differences between their simple example and your code.

    From html5rocks on slide #18 there is also an html5 example of another way to use drag and drop by adding the listener to the page.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

document.all[ + object.getAttribute(EndDate, true) + ].value; does work in firefox but work in IE.
My generated drop-down menu works in Firefox and IE but not Google Chrome. I
document.getElementById(ID).focus() not work in Google Chrome. Is there any alternative? Thank you.
document.getElementById(...).setAttribute('style',... is not working in Internet Explorer 7.0. How can I make this work
document.getElementById('logbox').scrollTop = document.getElementById('logbox').scrollHeight; I tried $('#logbox').scrollTop but there is not this attribute. How to
document.cookie is like a string, but it is not a string. To quote the
I have a particular code and it works fine on Google chrome but not
document.getElementById(ctrl).disabled = true; this works in IE but does not works in mozila. What
document.referrer in javascript is blank from a 302 redirect from http to https using
document.getelementbyid('txtbox') is not working when I used in content page as it is working

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.