How can I open a PDF stored in my wiki in a new tab?
I’m starting a wiki to track my work on a subcommittee of a local School Board I’ve recently joined. Each month, we will review 5 - 10 documents in PDF form. I’d like to include them in my wiki (which will be only for my own use.) Some of these PDFs are reasonably small: a few dozen KB. But a few are much larger: 1 - 4 MB.
These larger ones are not rendering inside TW; I’m not sure why. I was hoping to offer myself a simple workaround. From some other wikis, I’ve used a download link for binary documents, with the following code:
title: $:/_/macros/download-link
tags: $:/tags/Macro
\define download-link(title, text:"download", class:"")
<a
download=<<__title__>>
title=<<__title__>>
class={{{ [[binary]] [<__class__>] +[join[ ]] }}}
href={{{ [[data:]] [<__title__>get[type]] [[;base64,]] [<__title__>get[text]] +[join[]] }}}
><<__text__>></a>
\end
which I can use by
<div class="doc-downloads">Download as <<download-link "PDF tiddler title" "PDF">></div>
I brought that macro into the current wiki (and yes, at some time, I will need to switch to something newer than the macro, but I don’t think that’s at issue!), and while it works fine, I don’t really want to download the documents; if possible, I would like to simply open them in new tabs.
But adding target="_blank"
, with or without keeping the download
property doesn’t word:
- If I keep
download
, it simply offers to download the document - If I drop
download
, it opens a new tab, but with no content, and the URL:about:blank#blocked
(I’m using Brave.)
Any suggestions?