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

neunygph's avatar
neunygph
Explorer | Level 4
8 years ago

Dropbox JavaScript SDK vs Dropbox saver JavaScript

Hello,

 

I'm just starting to use Dropbox JavaScript SDK from http://dropbox.github.io/dropbox-sdk-js/Dropbox.html on my client side. But there is a conflict when using both refrences from 

 

<script src="https://unpkg.com/dropbox/dist/Dropbox-sdk.min.js" ></script>

 

AND

 

<script src="//www.dropbox.com/static/api/2/dropins.js" id="dropboxjs" data-app-key="riqoimk2j9c8d1m" ></script>

 

Both references has Dropbox object and Dropbox function (both same name) and this cause javascript error when creating a saver button. For instance:

 

var button = Dropbox.createSaveButton(options)

 

This createSaveButton will cause an error since there is no "createSaveButton" method from https://unpkg.com/dropbox/dist/Dropbox-sdk.min.js. Is there a way that I can distinguish these 2 "Dropbox" object/function so their methods can be called properly.

 

Thanks

  • These libraries weren't written with each other in mind unfortunately, but you can do something like this to work around it:

     

        <script src="https://www.dropbox.com/static/api/2/dropins.js" id="dropboxjs" data-app-key="riqoimk2j9c8d1m" ></script>
        <script type="text/javascript">
            var Dropbox_Dropins = Dropbox;
        </script>
    
        <script src="https://unpkg.com/dropbox/dist/Dropbox-sdk.min.js" ></script>
        <script type="text/javascript">
            var Dropbox_SDK = Dropbox;
        </script>

    And then you can use Dropbox_Dropins or Dropbox_SDK in place of Dropbox respectively.

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    These libraries weren't written with each other in mind unfortunately, but you can do something like this to work around it:

     

        <script src="https://www.dropbox.com/static/api/2/dropins.js" id="dropboxjs" data-app-key="riqoimk2j9c8d1m" ></script>
        <script type="text/javascript">
            var Dropbox_Dropins = Dropbox;
        </script>
    
        <script src="https://unpkg.com/dropbox/dist/Dropbox-sdk.min.js" ></script>
        <script type="text/javascript">
            var Dropbox_SDK = Dropbox;
        </script>

    And then you can use Dropbox_Dropins or Dropbox_SDK in place of Dropbox respectively.

    • neunygph's avatar
      neunygph
      Explorer | Level 4
      Ah I see, I didn't think of that :)

      Thanks Greg.
      • neunygph's avatar
        neunygph
        Explorer | Level 4

        Hi Greg,

         

        For drobox pin, is data-app-key value always "riqoimk2j9c8d1m" ?

        Thanks,

         

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,882 PostsLatest Activity: 3 years ago
325 Following

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 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!