Disable JavaScript for PDF

Hello,

I would like to disable JavaScript for PDF, unfortunately I didn’t find any option.

Does anyone know how to do that ?

BR Netmage

@Netmage,
Thank you for reaching out.
You are saying that you want to disable javascript for a PDF file you’re viewing in-browser? If so, simply view the PDF in the browser, click on the Shields icon in the address bar (lion icon), then toggle the Block scripts option “on”.
image

Hello Mattches,

thank you very much for your fast reply.

I assume that using this button is helpful when a pdf is embedded into a website. I would like to block JavaScript for every PDF file regardless of whether the PDF is embedded in any website or is a local file.

For example I am not able to block the JavaScript for this PDF, when I open it via local file. You can just reproduce it when downloading the file and open it via drag and drop:

@Netmage,
I see. So yes, unfortunately that is not an option given that, in that situation, the browser is simply acting as the PDF viewer. There may be an extension that can help with this but I’m not sure.

If I can ask, I’m curious what PDFs you’re viewing that have scripts embedded in them that you’d like blocked?

That is simple. I like brave and I like the brave pdf viewer.

I want to use brave pdf viewer even for local PDFs that could eventually be dangerous that’s all, so it is just to avoid that in the future someone embeds dangerous code into a pdf file.

Hey @Netmage

Is the actual pdf, the google drive link is just rendered on googles side, Though I would need to find actual pdfs with linking to javascript to properly test.

If you wanted to block all javascript files in pdf, add the following into brave://adblock, *.pdf$script

1 Like