1
0
-1

Hi,

We have a form which by clicking the button it will try to open a new window and render the PDF, but Chrome's pop up blocker always kick in the first time, you have to remember, if it is the first time doing it, you have to tell Chrome not to block it.

For someone who knows computers, it is probably ok, as when we see nothing happens, we will check out why it is not showing, but for average user, they may not know how to do this, and it will end up in a very bad user experience.

I don't know if it is something we can do on our side by scripting, or it is part of browsers behavior and nothing can be done.

 

The script when user clicked on generate PDF is

 

var url = Form.data.SFMData.SystemProfile.FormDataServiceURL;
if (url) {
url += "?sfmRequestKey=";
var requestKey = Form.data.SFMData.SystemProfile.RequestLogKey;
if (requestKey) {
url += requestKey;
url += "&sfmOperationName=renderReceipt";
if (item.properties.renderMode=="file") {
url += "&renderMode=file";
}
Form.submit('Saved', false, true, false, false, false)
.then(function() {
window.open(url,"_blank");
});
}

 

 

    CommentAdd your comment...

    1 answer

    1.  
      2
      1
      0

      Opening new windows via JavaScript is the type of activity the popup blocker is designed to stop.

      If you present a genuine link for the user instead then the popup blocker should not engage. In your case you have to call the Form.submit function first so you don't want to present the link until that is complete. One option would be to popup a Maestro dialog with a link in it instead of calling the window.open function.

      This has UX considerations but should avoid the blocker.

      CommentAdd your comment...