Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/449.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何识别我的应用程序页面是从另一个应用程序的框架内关闭的_Javascript_Jquery_Ajax_Onbeforeunload - Fatal编程技术网

Javascript 如何识别我的应用程序页面是从另一个应用程序的框架内关闭的

Javascript 如何识别我的应用程序页面是从另一个应用程序的框架内关闭的,javascript,jquery,ajax,onbeforeunload,Javascript,Jquery,Ajax,Onbeforeunload,我有一个在另一个内部运行的应用程序(在web上运行的ERP) 集成是通过在ERP框架的框架中加载我的页面完成的: <frame>My Apllication</frame> window.onbeforeunload = function() { try { var url = "../../authentication/api/logout.php", data = new FormData(); d

我有一个在另一个内部运行的应用程序(在web上运行的ERP)

集成是通过在ERP框架的框架中加载我的页面完成的:

<frame>My Apllication</frame>
  window.onbeforeunload = function() {
    try {
      var url = "../../authentication/api/logout.php",
      data = new FormData();
      data.append("logout", "1");
      navigator.sendBeacon(url, data);
    }
    catch (e) {
      $.ajax({
        url: "../../authentication/api/logout.php",
        type: "POST",
        data: { "logout": "1" }
      }
    }
  };