cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Organizing your research is important to easily review and share it. Learn how Kim uses Dropbox to gather and organize her research right here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
1
Ask
2
Comments

Dropbox JavaScript SDK vs Dropbox saver JavaScript

Dropbox JavaScript SDK vs Dropbox saver JavaScript

neunygph
Explorer | Level 4

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

1 Accepted Solution

Accepted Solutions

Re: Dropbox JavaScript SDK vs Dropbox saver JavaScript

Greg-DB
Dropboxer

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.

View solution in original post

5 Replies 5

Re: Dropbox JavaScript SDK vs Dropbox saver JavaScript

Greg-DB
Dropboxer

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.

Re: Dropbox JavaScript SDK vs Dropbox saver JavaScript

neunygph
Explorer | Level 4
Ah I see, I didn't think of that 🙂

Thanks Greg.

Re: Dropbox JavaScript SDK vs Dropbox saver JavaScript

neunygph
Explorer | Level 4

Hi Greg,

 

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

Thanks,

 

Re: Dropbox JavaScript SDK vs Dropbox saver JavaScript

Greg-DB
Dropboxer
That's just the app key you supplied in your original post. When loading the dropins library, that should always be the app key for the app you want to use the Chooser with. The "riqoimk2j9c8d1m" value does seem to be a valid app key for your app, so that's fine.

Re: Dropbox JavaScript SDK vs Dropbox saver JavaScript

neunygph
Explorer | Level 4

Oh ok, thanks Greg.

Who's talking

Top contributors to this post

  • User avatar
    neunygph Explorer | Level 4
  • User avatar
    Greg-DB Dropboxer
What do Dropbox user levels mean?
Need more support?