Your workflow is unique 👨💻 - tell us how you use Dropbox here.
Forum Discussion
Lisa S.66
10 years agoNew member | Level 1
Where does the JavaScript go?
I am very new at this. Where do I put the JavaScript at to make the chooser appear on my webpage?
This link says to use the JavaScript.
https://www.dropbox.com/developers/dropins/chooser/js#triggering
8 Replies
Replies have been turned off for this discussion
- Ryan M.10 years agoHelpful | Level 7
Sounds like you might want to start here:
JavaScript Introduction: Where To
http://www.w3schools.com/js/js_whereto.aspThe 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-DB10 years ago
Dropbox Community Moderator
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.6610 years agoNew member | Level 1
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-DB10 years ago
Dropbox Community Moderator
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.6610 years agoNew member | Level 1
I very much thank you for all your help. I am actually starting to get somewhere with all other this.
Okay, so I have this
https://www.dropbox.com/s/5ytuljdzhg4i07x/Screen%20Shot%202015-07-15%20at%203.37.51%20PM.png?dl=0
but I get this
https://www.dropbox.com/s/6a5ya9zogitjfz7/Screen%20Shot%202015-07-15%20at%203.39.25%20PM.png?dl=0What am I doing wrong?
- Greg-DB10 years ago
Dropbox Community Moderator
When using Drop-ins the domain(s) you want to use it on must be pre-registered on the App Console:
https://www.dropbox.com/developers/apps
Click on your app there and enter the domain for your site in "Drop-ins domains".
- Lisa S.6610 years agoNew member | Level 1
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-DB10 years ago
Dropbox Community Moderator
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
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!