Jump to content
Sign in to follow this  

Get download url using javascript?

Recommended Posts

I try to use Tampermonkey to get download url but it does not get download url using window.location.href

Is that not possible? I could not find any infomation about getting download url

I Just want get download url to see it without having to open downloads, console or fiddler 2

Share this post

Link to post
Share on other sites

Hello, @davidwilliam

Please try this code it works :

var file_path = 'host/path/file.ext';
var a = document.createElement('A');
a.href = file_path;
a.download = file_path.substr(file_path.lastIndexOf('/') + 1);

I hope above code will be useful for you.
Thank you.

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...