cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Create, upload, and share

Find help to solve issues with creating, uploading, and sharing files and folders in Dropbox. Get support and advice from the Dropbox Community.

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

Re: Saving URL to act as a URL Redirect?

Saving URL to act as a URL Redirect?

Bob A.3
New member | Level 2
Go to solution

I would like to be able to make a share link to a Dropbox file that itself contains a URL such that when the user executes the first link in their browser the end result is that the URL stored in the DB file gets executed through the domino effect of link calling link.  How can I best accomplish this?

I tried using the DB feature where you can save a URL to dropbox.  That does not meet my needs because I need to be able to change the URL saved within the drop box file.

Can this be done with JavaScript or would I also need to use the DB api in order to parse the URL stored in the DB file?  The DB file will only contain the URL... so really it would not need to be parsed if... so would JavaScript be able to do the whole job?

1 Accepted Solution

Accepted Solutions

Richard P.
Super User alumni
Go to solution

Yes, just fire off a GET request (via ajax or fetch, or your favourite http lib) to the exact public url for the file.

Ensure the file is structured as JSON, and you should be able to either directly read the response as JSON, or you may have to JSON.parse() it, and theres your data. 

Then do your favourite JS redirect.

The only issue is that the .html file which triggers all that cannot be stored on Dropbox as a public or shared link, it has to be stored elsewhere.

View solution in original post

5 Replies 5

DaveC2
New member | Level 1
Go to solution

Unless things have changed lately (and thats not impossible!), you would want to create a link to a html page that is stored in your dropbox, and that html page has a html redirector instruction.

Bob A.3
New member | Level 2
Go to solution

 

Dave,

How it works for me now is ...

1) User presses button with link to dropbox file

2) link stored in that dropbox file shows up in clear text in the browser window

 

I am hoping that I can store the redirector link in the drop box file such that...

A) user presses button with link to dropbox file

B) link stored in that dropbox file then auto executes and lands user on redirected page.

 

Are you suggesting that I use some redirector html tag to accomplish this STEP B?

 

Richard P.
Super User alumni
Go to solution

Dropbox is just about to stop allowing html files to be rendered via its shared links, so the HTML and Javascript route will be useless to you very very shortly as it will stop working.

Why do you want to do this on Dropbox? Its a very small, quick project for a web developer and you could send proper 301/302/303 redirects.

Bob A.3
New member | Level 2
Go to solution

There is no server involved with regard to my html so 301's etc can't be used.

Maybe I should ask the question this way...

Can I use Javascript to download a file from drop box via a public link. (ie. person not logged into Dropbox) and ingest the data (link) stored in that file into a JavaScript variable?

 

If I can do that then I can have the JavaScript then fire off that link that it got from the downloaded Dropbox file.

Richard P.
Super User alumni
Go to solution

Yes, just fire off a GET request (via ajax or fetch, or your favourite http lib) to the exact public url for the file.

Ensure the file is structured as JSON, and you should be able to either directly read the response as JSON, or you may have to JSON.parse() it, and theres your data. 

Then do your favourite JS redirect.

The only issue is that the .html file which triggers all that cannot be stored on Dropbox as a public or shared link, it has to be stored elsewhere.

Need more support?