Skip to main content

Box Embed widget - what (if any) iframe messages are posted to parent window?

  • November 20, 2023
  • 3 replies
  • 152 views

I’m attempting to use the Box Embed widget to serve as a file uploader – from the parent application, I would like to listen for events for things like onFileUpload, onFileDelete, etc. I’m wondering if the widget broadcasts any messages that would allow me to do this?


The problem I am trying to solve is to upload a file to the Box embed widget, and then store the file path of the newly uploaded file in the parent applications backend. But currently I do not receive any information back after the onFileUpload event, so the parent application does not know what the uploaded file path is.


I’m open to any and all other approaches that might unlock that. Thanks in advance for any guidance.

3 replies

ostefaniuk Box
  • Developer Advocate
  • 39 replies
  • November 24, 2023

Hi there,


Thanks for your question! Have you considered using Content Uploader Box UI Element? It includes dedicated events eg. upload which returns a bunch of information related to the uploaded file.


Example of logging data related to the uploaded file:


                const contentUploader = new Box.ContentUploader();

                contentUploader.show(folderId, accessToken , {

                    container: "#box-content-uploader",

                });

                contentUploader.on('upload', (data) => {

                    console.log(data.path_collection)

                    console.log(data.parent)

                    console.log(data.id)

                });


Installation:



Events related to Content Uploader:



Let me know if that helps!


Cheers,

Olga


  • Author
  • New Participant
  • 1 reply
  • November 24, 2023

Hi Olga – Thanks for your reply. Unfortunately I’m currently unable to utilize the ‘box-ui-elements’ package in this particular application, given it’s package size and the large number of peer dependencies required to be maintained.


ostefaniuk Box
  • Developer Advocate
  • 39 replies
  • November 24, 2023

Hi there, just one more question in this regard. Have you checked the possibility to include the UI Element using a CDN script link? This will not require package installation. You can include a single component, no requirement to add all of them.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings