Forum Discussion
Code Block and File Download
So i create a lot of custom blocks via the HTML block and it works very good until i want to include a handout in my HTML code.
<a href="assets/filename.pdf" class="download-btn" download target="_blank">
<svg viewBox="0 0 24 24">
<path d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"/>
</svg>
Merkblatt herunterladen (PDF)
The file is in the assets folder and it works when i click it on my desktop. When I use it in the Preview of Rise the button is unresponsive. Is this a known issue or am I doing something wrong?
Hi DonTino
You won't be able to access local files nor create files from within a custom code block in RISE. The code runs in a RISE 'sandboxed' environment - but the browser wouldn't allow you to do it anyway as your request would violate the CORS browser security rules.
You could try loading the pdf as a 'File Attachment' in RISE then capturing the url of the uploaded pdf file and using that in your code. You are then accessing a file which is already on the RISE server.
3 Replies
- JohnCooper-be3cCommunity Member
Hi DonTino
You won't be able to access local files nor create files from within a custom code block in RISE. The code runs in a RISE 'sandboxed' environment - but the browser wouldn't allow you to do it anyway as your request would violate the CORS browser security rules.
You could try loading the pdf as a 'File Attachment' in RISE then capturing the url of the uploaded pdf file and using that in your code. You are then accessing a file which is already on the RISE server.
- DonTinoCommunity Member
Thanks, that worked!
Related Content
- 3 months ago
- 5 months ago
- 10 months ago
- 2 months ago
- 2 months ago