Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force a download inside a link #11471

Open
javiercasares opened this issue Nov 4, 2018 · 2 comments
Open

Force a download inside a link #11471

javiercasares opened this issue Nov 4, 2018 · 2 comments
Labels
[Feature] UI Components Impacts or related to the UI component system [Type] Enhancement A suggestion for improvement.

Comments

@javiercasares
Copy link

When you have a link to a PDF or a document you should select an option to force as "download" (as HTML5 allows).

So, the HTML is generated like: <a href="something" **download**>text</a>

download-link

@designsimply
Copy link
Member

designsimply commented Nov 5, 2018

The file block has this option by default (screenshot) and I think that would be the preferred method for adding a link to a downloadable pdf if that's possible for you.

I also just read https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#Attributes and found that the download attribute only works for same-origin URLs, and since links are very commonly not using same-origin URLs it could get a bit confusing for some people to have it only be available sometimes—and this would also require that code be added to detect same-origin URLs which may add a lot of overhead for links which may not be needed for everyone (?) especially in the context of having another block (file block) available explicitly for that purpose. Because of these reasons, it may be a great option as a third-party plugin for people who very intentionally want that specific behavior.

@ToniSHernandez
Copy link

I was wondering if they could incorporate the ability to do "click on download" for images. As an example, we currently are offering some video conferencing backgrounds and want the user to simply click on it and it open up the file manager download dialog. Currently, the block does not support this capability and the block must be converted to HTML which removes the ease of adding alt text and other benefits of using the Gutenberg blocks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] UI Components Impacts or related to the UI component system [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

3 participants