Running Javascript in Android Pdf Reader


Is it actually possible to execute JavaScript within Android PDF readers, regardless of the version or app type? My understanding is that simply embedding the following script into the PDF should be enough to trigger the action, but it doesn't seem to be working.

1 0 obj  
  << /Type /Catalog  
/Pages 2 0 R  
/OpenAction 5 0 R  
/AcroForm << /Fields \[6 0 R\] >>  
  \>>  
...  
5 0 obj  
  << /Type /Action  
/S /JavaScript  
/JS (  
app.alert("Submitting data to example.com");  
this.submitForm({  
cURL: "https://urltest.requestcatcher.com/submit",  
cSubmitAs: "HTML",  
bEmpty: true  
});  
)  
  \>>

I’m unable to run the JavaScript required to submit the form to that URL. I’ve tested it on Android 14 and 15 using Adobe Acrobat Reader, WPS Office, and ezPDF, but it isn't working.

0
Mar 10 at 9:55 AM
User AvatarCyb3rCr0wCC
#javascript#android#pdf

Accepted Answer

Most PDF apps will disable JavaScript by default for security reasons. A user may need to specifically enable it for it to work.

User AvatarADyson
Mar 10 at 10:20 AM
3