Chrome and Javascript...

Without making my user change any settings, Can I have an ap alert that will run if the user opens the file in Chrome?

I realize the ap alert is JavaScript, so I think the answer is "no".


Peter Ottenbacher


4 Answers

Voted Best Answer

No. Chrome uses it's own PDF viewer that does not support many of the more advanced PDF features.

If you want to create a "message" for somebody who uses Chrome, you will have to create a document that uses a combination of layers and JavaScript that will actually hide the message when you open the document in a full featured PDF viewer. When you view the file in a limited PDF viewer, the message cannot be hidden, and will be shown to the user.

Karl Heinz Kremer
PDF Acrobatics Without a Net
PDF Software Development, Training and More...
http://www.khkonsulting.com


By Karl Heinz Kremer   

You can test whether the document is being viewed in the Adobe application or an external window (like a web browser) but not Chrome specifically.

if (this.external){app.alert("Viewing in external window")}

However, this javascript is not supported by most non-Adobe pdf viewers and also, I don't think you can view pdfs in the latest version of Chrome any more. It now forces downloading.


David Dagley   

Although Chrome's built-in PDF viewer (named pdfium) has limited support for JavaScript, it does support the app.alert method. Some things, such as the oCheckbox parameter, are not supported, but it will display a basic alert.


George Johnson   

Also, though pdfium has limited support for JavaScript, it's not bad. The bad part is the documentation is limited or nonexistent, but at least you can examine the source code to see what's supported and to what extent.


George Johnson   


Please specify a reason: