0

I have an angularJS frontend that I redirect to a third party payment gateway when a customer clicks on the Pay button.

I am currently using the following function to redirect to the payment gateway:

if(status.data.result == "true"){
var ref = window.open(url,'_self');
}
};

This code works well when I try it on localhost. But does not work when I put it on the ubuntu server.

Any ideas on why?

Regards, Galeej

galeej
  • 535
  • 9
  • 23

3 Answers3

0

Try adding return false after var ref = window.open(url,'_self'); like

var ref = window.open(url,'_self');
return false;

return false will prevent from page submit and it may work this way to properly redirect on the same page.

Ankit Agarwal
  • 30,378
  • 5
  • 37
  • 62
0

May be your content security policy is blocking this url to load. You can try using _blank instead of _self to see if that is the case. Also it would be better to use $window, because angular.

Also are you using the fully qualified URL ?

arbghl
  • 358
  • 2
  • 14
  • we are using a fully qualified url. How do I check the content security policy? will check with _blank and get back – galeej Jul 04 '17 at 07:21
  • `window.open(url,'_blank')` should open in a new tab. – arbghl Jul 05 '17 at 00:01
  • Hey, this issue was fixed. We used window.location = url and it worked like a charm. Thanks for all the help! – galeej Jul 05 '17 at 05:44
0

The solution that worked for us was using window.location = url

galeej
  • 535
  • 9
  • 23