Your workflow is unique 👨‍💻 -  tell us how you use Dropbox here.

Forum Discussion

8 Replies

Replies have been turned off for this discussion
  • Ryan M.'s avatar
    Ryan M.
    Helpful | Level 7
    10 years ago

    Sounds like you might want to start here:

    JavaScript Introduction: Where To
    http://www.w3schools.com/js/js_whereto.asp

    The demo instructions on the Dropbox website tell you what to embed on the page

    <script type="text/javascript" src="https://www.dropbox.com/static/api/2/dropins.js" id="dropboxjs" data-app-key="YOUR_APP_KEY"></script>
    
  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    10 years ago

    The JavaScript code on a web page should go in a <script> tag. As for when to run it, for the JavaScript that creates the button, you'll probably want to run that when the page loads. How exactly you do that depends on what libraries you're using, if any, (e.g,. jQuery, etc.), so I can't answer that specifically for you.

    Of, if you are using a custom button instead, the JavaScript to trigger the Chooser to appear should be run from the event caused by the user (e.g., when they click a custom button or like on your page).

  • Lisa S.66's avatar
    Lisa S.66
    New member | Level 1
    10 years ago

    Okay, so I added this

    <button type="button">Try it</button> 
    

    after

    <style>
        var button = Dropbox.createChooseButton(options);
        document.getElementById("container").appendChild(button);
    </style>
    

    I do not think that was was I was supposed to do.

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    10 years ago

    Your button doesn't seem to be hooked up to anything, and you added your JavaScript code inside a <style> tag instead of a <script> tag.

    I recommend reading through the Chooser documentation again, and getting some help with the general HTML/CSS/JavaScript development for your page if you're having trouble. That's outside the scope of Dropbox API support of course though, so I can't offer much help there.

    I have a simple sample page that uses the Chooser here though:

    https://dl.dropboxusercontent.com/u/27506755/chooser_js_simple.html

    You can look at the source to see how it works.

  • Lisa S.66's avatar
    Lisa S.66
    New member | Level 1
    10 years ago

    Thanks Greg! It works! Unfortunately though this is not what I thought It was. I need the users to be able to view and download from a specific app folder and only that specific app folder without having to sign in. Is there something like that?

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    10 years ago

    No, there currently isn't a way to restrict the Chooser to a certain path like that, but I'll be sure to pass this along as a feature request.

    (Unless you mean you want them to be able to view and download from your account only? In that case, you may just want to use a shared link to a folder in your account: https://www.dropbox.com/help/167 )

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!