cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Check out the Dropbox cheat sheet for getting started in 2021 here!

Discuss Dropbox Developer & API

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

sharing url files using iframe

sharing url files using iframe

Helpful | Level 5

Hi all,

 

I am trying to access my files, through generating shared url, which I managed to do using python for my website. I am trying to implement an iframe 3d model viewer, which require a certain file with dxf or dwg extension, which typically generated from CAD file. However, when I provide the url and change the dl=1 or use raw=1, as shown below:

 

https:confused face:/www.dropbox.com/s/example/skyline.dxf?dl=1

 

https:confused face:/www.dropbox.com/s/example/skyline.dxf?raw=1

 

I also looked at the dropbox documents regarding to embedding files--that didn;t help me much because it uses dropbox to view the files. my iframe require using a certain viewer which only need direct access to the file.

 

Is there a better way to access and provide a driect link to the file, to view the model?

 

Thank you for feebacks in advance

3 Replies 3

Re: sharing url files using iframe

Dropboxer

Using the raw=1 parameter, as documented here, is the right way to get direct access to the file content from a shared link like this. It sounds like that's not working for you though. Are you getting any particular error or unexpected output?

 

Note that the client will need to be able to follow redirects, so if your viewer doesn't support that, that may be the issue.

 

Alternatively, if temporary links would work for your use case, you could get temporary direct links (which don't require a redirect or URL parameter modification) by calling /2/files/get_temporary_link, which is available as files_get_temporary_link in the official Dropbox Python SDK.

Re: sharing url files using iframe

Helpful | Level 5

@Greg-DB

Many thanks for your prompt response, much appreciated. I tried using the temporary link but with no success, the viewer keep showing me the loading page but the status never change. I guess I have to dig deeper to find out what is not working.

 

I just noted while using files_get_temporary_link will generate a link with other metadata. Is there a direct method to only retrieve the temporary link as str?

Re: sharing url files using iframe

Dropboxer

No, there isn't another call like that with a string returned directly. You should access the string in the returned GetTemporaryLinkResult.link field. Does accessing that field not work in your environment for some reason?

 

As for viewing the file itself, you may want to check the JavaScript console for the page where the viewer isn't successfully loading the file, in case there's some helpful error or output there.

Polls
Are you starting new work habits this year?

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Who's talking

Top contributors to this post

What do Dropbox user levels mean?
Need more support?