Dropzone
  • 👋Introduction
  • Getting Started
    • ⏬Installation
      • npm or yarn
      • Composer
      • Stand-alone file
    • ✅Setup
      • Declarative
      • Imperative
      • Server Side Implementation
      • Fallback for no JavaScript
  • Configuration
    • ⚙️Basics
      • Configuration Options
      • Layout
      • Methods
      • Upload Queue
    • 📞Events
    • 💅Theming
    • 🤓Tutorials
      • Combine form data with files
  • Miscellaneous
    • Tips & Tricks
    • FAQ
    • Donate
Powered by GitBook
On this page

Was this helpful?

  1. Getting Started
  2. Setup

Fallback for no JavaScript

In case you want to handle browsers that don't have JavaScript enabled.

Sometimes you need to build websites that should work even if the user doesn't have JavaScript enabled or the browser is not supported. Of course, a drag'n'drop JavaScript library won't work in these cases, but Dropzone got you covered by offering a way to define a fallback.

Inside your dropzone HTML element (in most cases that's a <form> element), you can define an additional element with the class fallback . When (or in this case: "if") Dropzone initializes, it will simply remove this element.

Here is an example of what this might look like:

<form action="/file-upload" class="dropzone">
  <div class="fallback">
    <input name="file" type="file" multiple />
  </div>
</form>

So in case the browser doesn't support JavaSript, the user will simply see the fallback div with the file input element, and everything will work normally but with no drag and drop support.

If the browser is supported however, this element will be removed, and Dropzone will add a notice that it accepts dropped files and handle them.

PreviousServer Side ImplementationNextBasics

Last updated 4 years ago

Was this helpful?

✅