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

bspindia's avatar
bspindia
Helpful | Level 7
2 years ago

Dropbox Embeder

able to embed pdf using anchor tags

but getting error as Drobox is not defined when trying to embed using Drobox(option,element)

  • Здравко's avatar
    Здравко
    Legendary | Level 20

    bspindia, Are you sure keep still set up the Embedder properly? 🤔 Make sure you put in the "dropins" script, at least (the Dropbox object comes from there).

     

    PS: Make sure you remove all possible typos in your code! 😉 (Drobox ≠ Dropbox)

    • bspindia's avatar
      bspindia
      Helpful | Level 7

      if i wouldn't appended the dropoin script to body, how would anchor tag embed will work ?

       

      function textBookLibrary(){
      $(".mNavCntnt").empty();
      $(".mNavCntnt").append(
      $("<div>").attr('class','tbContainer').append(
      $("<div>").attr('name','subject').text("Health and Physical Science"),
      $("<div>").attr("name",'chapter').append(
      $("<span>").text("Chapter 1")
      ),
      $("<a>").attr({
      //'height':'400px','width':'200px',
      //'frameborder':'0',
      'class':'tbLesson',
      'type':'application/pdf',
      //'src':'assets/textBooks/jehp1ps.pdf',
      }).addClass('dropbox-embed')
      )
      )
       
      /*
      let options = {
      // Shared link to Dropbox file
      file: {
      // Sets the zoom mode for embedded files. Defaults to 'best'.
      zoom: "best" // or "fit"
      },
      folder: {
      // Sets the view mode for embedded folders. Defaults to 'list'.
      view: "list", // or "grid"
      headerSize: "normal" // or "small"
      }
      }
      Dropbox.embed(options,$(".tbLesson"));
       
      */

       

       

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

    bspindia Importing the dropins.js script is required for both ways of using the Embedder (that is, via anchor tags or via JavaScript). Make sure you set it up as shown in the documentation.

    • bspindia's avatar
      bspindia
      Helpful | Level 7

      i imported it hence working for anchor tag,

      issue with Dropbox.embed()

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

        bspindia Using Dropbox.embed is currently working for me. As Здравко noted, I see the latest code you shared is not the same as you originally shared though. So, can you confirm what error you are currently getting? If you're still seeing an issue, it would be useful if you share the exact code and steps you're using that reproduce the issue, as well as the full/exact error you're getting.

  • Здравко's avatar
    Здравко
    Legendary | Level 20

    bspindia wrote:

    ...

    but getting error as Drobox is not defined when trying to embed using Drobox(option,element)



    bspindia wrote:

    ...

    issue with Dropbox.embed()


    Hm.. 🤔 .. Ok. What's the issue now? Is it still not defined? 🧐 or...