在特定的URL angularjs angularjs关闭窗口 [英] close window in angularjs on specific url angularjs

查看:393
本文介绍了在特定的URL angularjs angularjs关闭窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来angularjs,所以这个问题可能看起来愚蠢体验的人,但我真的不能够执行此,任何机构可以告诉我,如何从web视图回来的应用延伸到特定的URL后,就像我我在浏览器中打开一个窗口付款过程,使我需要的是,当URL中的WebView来了一个成功的味精,我想关闭该网页视图,并回到我的申请,我瞪大眼睛,并找到了一种方法,在$窗口。开()我们通过三个参数,并通过第二个我能做到这一点,但不知道如何实现,任何一个可以提供给我一个方法来处理的。

我研究THI链接: - 跟踪整个页面加载一个子窗口

我想这也是功能: -

\r

感谢


解决方案

请有它一看: -
<一href=\"http://stackoverflow.com/questions/28752424/close-a-child-window-in-an-android-app-made-with-angularjs\">Close子窗口在一个Android应用程序与Angularjs

这是我的回答更新...我已经测试它
其工作罚款

\r
\r

VAR URL =test_Url;\r
\r
VAR socialLoginWindow =窗口\r
  。开(URL,\r
    '_空白',\r
    位置=无');\r
//听页面加载\r
//事件\r
socialLoginWindow\r
  阅读进度(\r
    loadstart',\r
    功能(\r
      事件){\r
      VAR URL = event.url;\r
      如果(URL ==htt​​p://www.magentomobileshop.com/demo/index.php/payu/index/success/){\r
        socialLoginWindow\r
          。关();\r
      }\r
\r
    });

\r

\r
\r

这里是参考链接它: -

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

下面Loadstart将跟踪你的window.So网址的每一个变化,当前的URL可以从event.url获得

干杯!
快乐编码。

I am new to angularjs , so this question might seems silly to experience ones , But i really not able to perform this , can any body tell me that how to come back to app from webview after reaching to specific url , Like i am opening a window in browser for payment process so what i need is that when url in webview comes up with a success msg , i want to close the webview and get back to my application , I goggled and found a way that in $window.open() we pass three parameters and through second i can do that , but don't know how to implement that , can any one provide me a way to deal that.

i studied thi link :- Tracking a child window across page loads

i tried this function too :-

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

Thanks

解决方案

Please have a look on it :- Close a child window in an Android app made with Angularjs

here is my updated Answer ...and I have tested it and its working fine

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 reference link for it :-

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

Here "Loadstart" will track your every change of url in window.So, the current URL can be get from event.url

Cheers !!! Happy coding.

这篇关于在特定的URL angularjs angularjs关闭窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆