You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
IceManLoneWolf
5 years agoExplorer | Level 3
Triggering the Embedder using JavaScript
var options = {
// Shared link to Dropbox file
link: "https://www.dropbox.com/sh/keptcjl08q3wsid/AACui966iXcXPbagCJ2py2L-a?dl=0",
file: {
// Sets the zoom mode for embedded ...
- 5 years ago
Thanks! Yes, you'll also need to define "element" which will depend on your page, but should be the element on your page where you want to put the Embedder.
For example, if you have an element on your page like this:
<div id="folder_container"></div>
Then you might define 'element' like this:
var element = document.getElementById("folder_container");
IceManLoneWolf
Explorer | Level 3
Thanks for responding. I get the following error in console.
Uncaught ReferenceError: element is not defined
Greg-DB
5 years agoDropbox Staff
Thanks! Yes, you'll also need to define "element" which will depend on your page, but should be the element on your page where you want to put the Embedder.
For example, if you have an element on your page like this:
<div id="folder_container"></div>
Then you might define 'element' like this:
var element = document.getElementById("folder_container");
- IceManLoneWolf5 years agoExplorer | Level 3
Thanks. That did the trick.
- Bryantsssss3 years agoExplorer | Level 4
Do you have an example of the full code? I am still having the same issue.
- Greg-DB3 years agoDropbox Staff
Bryantsssss Exactly how the code should look will depend on your scenario and what you're trying to build. You can find the full instructions, plus a live working example, on the Embedder page here.
Here's what a minimal example of triggering the Embedder using JavaScript might look like:
<!DOCTYPE html> <html> <script src='//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js' type='text/javascript'></script> <script type="text/javascript" src="https://www.dropbox.com/static/api/2/dropins.js" id="dropboxjs" data-app-key="APPKEYHERE"></script> <script type="text/javascript"> $(document).ready(function() { var url = "https://www.dropbox.com/s/u0bdwmkjmqld9l2/dbx-supporting-distributed-work.gif?dl=0"; var element = document.getElementById("file_container"); var options = { link: url, file: { zoom: "best" } }; Dropbox.embed(options, element); }); </script> <div style="height:600px;width:800px" id="file_container"></div> </html>
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,882 PostsLatest Activity: 3 years agoIf 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 or Facebook.
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!