Hi,
A comany website I’m developing have an IR module, and they need to have files available for download.
Why doesn’t the download button work?
Hi,
A comany website I’m developing have an IR module, and they need to have files available for download.
Why doesn’t the download button work?
Hi @kasper
Both URL and Blob is part of the Web API, thus not available on the server side of your app.
Have a look at this Stack Overflow answer that I think it will help you w/ this issue
Hope this helps
For anyone that want to use the file download block, I wrote this litte processor that solves it.
const fileBlock = {
name: 'fileBlock',
test: ({ node }) => node.component === "div" && node.props.className === "wp-block-file",
processor: ({ node }) => {
node.children[0].props.target = "_blank";
node.children[0].props.rel = "noreferrer noopener";
if ( node.children[1] ) {
node.children[1].props.target = "_blank";
node.children[0].props.rel = "noreferrer noopener";
}
return node;
}
}
};
export default fileBlock;
Just realized that I have solved a problem that does no longer exist. The file block has been updated with a toggle so that you can set the target to blank in the editor. But still, this processor makes sure that even if you forget it, it works.