Is there a way to force downloads

27 views
Skip to first unread message

Žygimantas Šalkus

unread,
Apr 24, 2020, 10:45:06 AM4/24/20
to sphinx-users
Hello, I have an issue with :download: role. Whenever I add any file that browser is able to display, e.x. json, pdf, browser displays it instead of downloading it to my computer. Is there a way to force file download, so file wouldn't be opened in a new tab?

Komiya Takeshi

unread,
Apr 24, 2020, 12:24:22 PM4/24/20
to sphinx...@googlegroups.com
Hi,

What version of Sphinx do you use? The latest Sphinx uses `download`
attribute to the download link in HTML5 output. So modern browsers
will start downloading the target file.

Thanks,
Takeshi KOMIYA

2020年4月24日(金) 23:45 Žygimantas Šalkus <z.sa...@gmail.com>:
>
> Hello, I have an issue with :download: role. Whenever I add any file that browser is able to display, e.x. json, pdf, browser displays it instead of downloading it to my computer. Is there a way to force file download, so file wouldn't be opened in a new tab?
>
> --
> You received this message because you are subscribed to the Google Groups "sphinx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sphinx-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sphinx-users/3c3a67df-4118-4237-aebd-b0e41430553c%40googlegroups.com.

Žygimantas Šalkus

unread,
Apr 24, 2020, 1:08:54 PM4/24/20
to sphinx...@googlegroups.com
I am using v3, the latest stable which I got from pip.

You received this message because you are subscribed to a topic in the Google Groups "sphinx-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sphinx-users/w_6HUUkb1Xk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sphinx-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sphinx-users/CAFmkQAONORaAfppu5ZnEpquZuHLJEphEvKLZgiZKY8BB3Av3aA%40mail.gmail.com.

Komiya Takeshi

unread,
Apr 26, 2020, 12:26:07 PM4/26/20
to sphinx...@googlegroups.com
Hmm... it's strange. Could you try this page? This is also built by
latest release.
https://sphinx-download-example.readthedocs.io/en/latest/

If it works fine for you, I guess you browsed HTML from local
directory. Some kind of browsers does not work "download" attribute
for anchor tags on local HTML browsing. If so, please upload your
document to server and try it again.

Thanks,
Takeshi KOMIYA

2020年4月25日(土) 2:08 Žygimantas Šalkus <z.sa...@gmail.com>:
> To view this discussion on the web visit https://groups.google.com/d/msgid/sphinx-users/CAAs90ZZR1JXf1KSyiw80BgQXoYyi%2B56UqzQd9SWV4EKLV37oSg%40mail.gmail.com.

Žygimantas Šalkus

unread,
Apr 27, 2020, 3:41:59 AM4/27/20
to sphinx...@googlegroups.com
Yes, I browsed HTML locally. Since documentation isn't finished, I'm not eager to host it somewhere. I guess after uploading the document to the server it should work. Thanks for the help.

Kevin Sheppard

unread,
Apr 27, 2020, 4:02:11 AM4/27/20
to sphinx...@googlegroups.com
You can use a local webserver (e.g., Mongoose  https://cesanta.com/binary.html) to get a local-only but realistic experience of viewing any site. 

Reply all
Reply to author
Forward
0 new messages