AngularJS:弹出窗口阻止程序阻止$ http成功后,尝试在新窗口/选项卡中打开页面

时间:2017-03-13 16:53:06

标签: javascript angularjs

我在用户通过AngularJS表单提交信息后尝试在新标签/页面中打开一个窗口。但是,Chrome的弹出窗口拦截器阻止了此操作。

这是我$http

中的app.js个请求部分
// function to process the form
$scope.processForm = function() {
    $http({
      method  : 'POST',
      url     : 'docusign.php', // PHP script generates URL from form data
      data    : $scope.user  // pass in data as strings

     })
      .success(function(data) {
            window.open(data); // this gets prevented by Chrome's popup blocker
            //The root of the new page I'm trying to open is https://www.docusign.net
            // -- Am I getting a pop-up block because I'm trying to take the user to a 
            // different website?
        });
};

1 个答案:

答案 0 :(得分:-1)

// function to process the form
$scope.processForm = function() {
    $http({
      method  : 'POST',
      url     : 'docusign.php', // PHP script generates URL from form data
      data    : $scope.user,  // pass in data as strings
      async   : false

     })
      .success(function(data) {
            window.open(data, '_blank'); // this gets prevented by Chrome's popup blocker
        });
};