Close window in angularjs on specific angularjs url

I am new to angularjs, so this question may seem silly to try, but I really am not able to accomplish this, can any body tell me that how to return to the application from webview after reaching a specific URL, As I open a window in the browser for the payment process, so I need that when the url in the webview comes with msg success, I want to close the webview and return to my application, I should study and find a way that is in $ window. open () we pass three parameters, and in a second I can do it, but I donโ€™t know how to implement it, can anyone provide me with a way to handle this.

I studied this link: - Tracking a child window through page loading

I also tried this function: -

if (!$window.closed){ if($window.location.href =="http://www.magentomobileshop.com/demo/index.php/payu/index/success") { $window.close() } } 

thanks

+3
source share
2 answers

Please look at this: Close a child window in an Android application made using Angularjs

here is my updated answer ... and I tested it and its working tone

 var url = "test_Url"; var socialLoginWindow = window .open(url, '_blank', 'location=no'); // listen to page load // events socialLoginWindow .addEventListener( 'loadstart', function( event) { var url = event.url; if (url == "http://www.magentomobileshop.com/demo/index.php/payu/index/success/") { socialLoginWindow .close(); } }); 

And here is the link for him: -

https://forum.ionicframework.com/t/opening-external-link-and-closing-it-at-an-event/6660/9

Here, "Loadstart" will track every change in the URL in the window. Thus, the current URL can be obtained from event.url

Greetings !!! Happy coding.

+2
source

Use $ window.close () in the $ window service. You can broadcast the result to another controller, such as AngularJS - Communication between controllers

can you check if this answers your question? How to close a browser window in AngularJS

You can use $ window.location.href to verify that the specific URL will be true.

+1
source

Source: https://habr.com/ru/post/954739/


All Articles