Skip to main content
yankleber
Inspiring
July 14, 2018
Answered

Detect if PDF document is being opened in Reader and not in a browser tab

  • July 14, 2018
  • 1 reply
  • 6188 views

So, the title of my thread is very straight forward and that's what I am after... a piece of JS code that ensures me that the document IS in Reader.

The reason is because I have a set of PDF documents stuffed with a lot of JS and that just get stuck when the user's browser opens it in a tab instead to download it.

I kind of worked it around by adding the HTML5 property 'download' at my links declaration to force the download, however I know that not all browser versions recognizes it so once in a while I still will have someone staring to a broken document into a browser tab.

I would appreciate immensely if someone could tell me if it does exist such JS code that may help me with this detection.

Thanks!

This topic has been closed for replies.
Correct answer try67

The way to do it is to display an error message by default, and then hide it when the script detects that the file is opened in Adobe software. That way, even if JS is not supported at all, the error message will still show up when the file is opened.

1 reply

Brainiac
July 14, 2018

Some browsers don't run any of your JavaScript... so how would a piece of code deal with this...?

yankleber
yankleberAuthor
Inspiring
July 14, 2018

I already got the solution, thanks!

PS: Actually I didn't need any JS piece of code!

Participating Frequently
September 16, 2020

hi,

 

can you share it? I am having the same problem....

Thanks!