Skip to main content
June 15, 2017
Question

Reader (but acrobat has no issue) gets notallowed error on app.launchUrl usage

  • June 15, 2017
  • 2 replies
  • 1185 views

usage occurs on button press, app.launchurl is inside a trusted js file in the javascript folder of reader dc

how do i get reader to be cool? i'm just trying to get gmail and gcal to pop up

Everything i looked at saying it only works in batch and console but i don't understand why it would work in acrobat versus reader. Is reader not allowed to app.launchurl? Any help would be greatly appreciated.

This topic has been closed for replies.

2 replies

try67
Community Expert
Community Expert
June 15, 2017

Can you post the full code, not just of the trusted function, but also in your file?

What error message are you getting in Reader?

Actually, launchURL does not require a trusted context at all, so this is very odd...

June 15, 2017

sorry didn't see your post makes sense to post it all - thanks for the quick replies

// FOR BUTTON MOUSE UP EVENT JAVASCRIPT

var list = this.getField("orderList");

var shop = this.getField("SHOP NAME").value;

var ALL = "";

var subject = "&su=Draeger+Supply+Order+for+"+shop;

var basicUrl = "https://mail.google.com/mail/u/0/?view=cm&fs=1";

var emailto = "&to=workemail@mywork.com";

var body = "&body=";

for(var i = 0; i <list.numItems; i++)

{

    body+=list.getItemAt(i,false)+"%0a";

}

ALL+=basicUrl+subject+emailto+body;

openGmail(ALL);

//trusted function: openGmail -  definition

var openGmail = app.trustedFunction(

    function (stringUrl){

        app.beginPriv();    // Explicitly raise privilege

  app.launchURL(stringUrl,true);

  app.endPriv();

});

//error message received while trying to use button in adobe reader dc

NotAllowedError: Security settings prevent access to this property or method.

Doc.subject:5:Field SEND WITH GMAIL:Mouse Up

//results from button use in adobe acrobat Xi

well it opens the tab and a new gmail is ready to compose

Joel Geraci
Community Expert
Community Expert
June 15, 2017

In that case, just use the mailDoc method of doc. Assuming Gmail is the default mail application, you'll get the gmail UI opened in a browser.

Acrobat DC SDK Documentation

Bernd Alheit
Community Expert
Community Expert
June 15, 2017

Can you post the code of the trusted function?

June 15, 2017

var openGmail = app.trustedFunction(

    function (stringUrl){

        app.beginPriv();    // Explicitly raise privilege

  app.launchURL(stringUrl,true);

  app.endPriv();

});

Joel Geraci
Community Expert
Community Expert
June 15, 2017

What is your goal exactly? Gmail is one of the web-based email systems that Acrobat/Reader natively support. You may be able to get away with mailto: links.