mozilla / pdf.js

PDF Reader in JavaScript
https://mozilla.github.io/pdf.js/
Apache License 2.0
48.34k stars 9.97k forks source link

Question about javascript in Anchor Elements #8140

Closed javierecf closed 7 years ago

javierecf commented 7 years ago

Configuration:


I have a quick question, is there anyway to support or enable ejecution of Javascript code from the click event of anchor elements in the PDF viewer?, until the last firefox update (52), i was using Adobe Acrobat and its firefox plugin support this only asking to do so for security reasons.

Is there a way to achieve something like invoking code such as "javascript:MyFunction()" from the links inside the PDF inside the PDF viewer?

thanks for your time.

Snuffleupagus commented 7 years ago

Borrowing the answer from https://github.com/mozilla/pdf.js/issues/8108#issuecomment-282408504, since it applies here as well:

PDF.js does not execute any JavaScript embedded in a PDF file for security reasons. The only exception is the print command to initiate printing a document, which is handled separately. Other JS is disabled and so far we do not intend to enable any other JS because of security concerns.

Closing as answered.