<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PlatingInspectionNew.aspx.cs" Inherits="MESWebSite.Manage.PlatingInspectionNew" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
</head>
   <script  type="text/javascript">
       var u = 'http://10.60.101.97:8888/bi/Viewer?proc=1&action=viewer&hback=true&db=!4e8c!!5382!MES!55b7!!6d82!!62a5!!8868!!2f!!55b7!!6d82!!68c0!!6d4b!!8bb0!!5f55!.db&platform=PC&au_act=login&adminv=MES&passv=123';
       window.onload = function () {
           
           newWin(u);
           //document.body.addEventListener('click', function () {

           //    alert("234234");
           //    newWin('http://www.baidu.com');
           //});
       };
      

       function newWin(url) {
           var a = document.createElement('a');
           a.setAttribute('href', url);
           a.setAttribute('style', 'display:none');
           a.setAttribute('target', '_blank');
           document.body.appendChild(a);
           a.click();
           a.parentNode.removeChild(a);
       }
      
       //window.addEventListener('click', () => {
         
       //    console.log('点击这里!');
       //});
       //let activeElement;
       //let iframeCheckTimer = setInterval(() => {

       //    var _iframe = document.getElementById("reportFrame")
       //    console.log("sdsfdsdfs")
       //    _iframe.contentWindow.addEventListener("message", (event) => {
       //        console.log("23424werwe")
       //        const data = event.data ? JSON.parse(event.data) : null;



       //        if (data && data.action == "OpenedDBID") {

       //            console.log('Opened DB id: ', data.id);

       //        }

       //    });
       //    _iframe.contentWindow.addEventListener("message", (event) => {
       //        alert("sdsdsfds");
       //        const data = event.data ? JSON.parse(event.data) : null;



       //        if (data && data.action == "OpenedDBID") {

       //            console.log('Opened DB id: ', data.id);

       //        }

       //    });


       //    //if (document.activeElement) {
       //    //    if (activeElement == document.activeElement) return;

       //    //    activeElement = document.activeElement;

       //    //    if (activeElement && activeElement.tagName == 'IFRAME') {
       //    //        console.log('iframe被激活 ');
       //    //    }
       //    //}

       //})

       //window.onload = function () {

          
       //}
       </script>
<body>
<form id="form1" runat="server" >

<%--    <iframe id="reportFrame" src="http://10.60.101.10:8401/webroot/decision/view/report?viewlet=reportE.cpt&op=write" width="100%" height="800px"></iframe>--%>
   
<%--    <iframe id="reportFrame"   src="http://10.60.101.97:8888/bi/Viewer?proc=1&action=viewer&hback=true&db=!4e8c!!5382!MES!55b7!!6d82!!62a5!!8868!!2f!!55b7!!6d82!!68c0!!6d4b!!8bb0!!5f55!.db" width="100%" height="800px" sandbox="allow-scripts allow-same-origin allow-top-navigation"></iframe>--%>
 <iframe id="reportFrame"   width="100%" height="800px"> </iframe>
   <%--<div>
       <script type="text/javascript">
           alert("dff33f");
           window.onload = function () {
               alert("dfff");
               //if (window != top) {
               this.location.href = "http://10.60.101.97:8888/bi/Viewer?proc=1&action=viewer&hback=true&db=!4e8c!!5382!MES!55b7!!6d82!!62a5!!8868!!2f!!55b7!!6d82!!68c0!!6d4b!!8bb0!!5f55!.db&platform=PC&au_act=login&adminv=MES&passv=123";
               //}
           }
    </script>

   </div>--%>

     <script  type="text/javascript">
         var url1 = "http://10.60.101.97:8888/bi/Viewer?proc=1&action=viewer&hback=true&db=!4e8c!!5382!MES!55b7!!6d82!!62a5!!8868!!2f!!55b7!!6d82!!68c0!!6d4b!!8bb0!!5f55!.db&platform=PC&au_act=login&adminv=MES&passv=123";
         //let targetWindow = window.open(url1, "_self");
        
         //let targetWindow = window.open(url1, "_blank");
         //let targetWindow = window.open(url1, "_parent");

         function newWin(url) {
             alert("sdsfdsdf");
             var a = document.createElement('a');
             a.setAttribute('href', url);
             a.setAttribute('style', 'display:none');
             a.setAttribute('target', '_blank');
             document.body.appendChild(a);
             a.click();
             a.parentNode.removeChild(a);
         }
         document.body.addEventListener('click', function () {

             alert("234234");
             newWin('http://www.baidu.com');
         });

         //window.onload = function () {
         //    var newWin = window.open();
         //    newWin.document.body.innerHTML = "正在加载中......";
         //    alert("11111");
         //    $.ajax({
         //            url: 'http://10.60.101.97:8888/bi/Viewer?proc=1&action=viewer&hback=true&db=!4e8c!!5382!MES!55b7!!6d82!!62a5!!8868!!2f!!55b7!!6d82!!68c0!!6d4b!!8bb0!!5f55!.db&platform=PC&au_act=login&adminv=MES&passv=123',
         //        success: function (url2) {
         //            newWin.location.href = 'http://10.60.101.97:8888/bi/Viewer?proc=1&action=viewer&hback=true&db=!4e8c!!5382!MES!55b7!!6d82!!62a5!!8868!!2f!!55b7!!6d82!!68c0!!6d4b!!8bb0!!5f55!.db&platform=PC&au_act=login&adminv=MES&passv=123';

         //            alert("aaaaaa");
         //        },
         //        error: function () {
         //            alert("bbbbbb");
         //        }

         //        }
         //    );

             //if (window != top) {
             //this.location.href = "http://10.60.101.97:8888/bi/Viewer?proc=1&action=viewer&hback=true&db=!4e8c!!5382!MES!55b7!!6d82!!62a5!!8868!!2f!!55b7!!6d82!!68c0!!6d4b!!8bb0!!5f55!.db&platform=PC&au_act=login&adminv=MES&passv=123";
             //}
         }




      
         //self.close();
         //if (window.opener) {
         //    window.opener.close();
         //}
         //window.close();
         
        
    
         //Response.redirect(url);

        // Server.Transfer(url);
        // Server.redirect(url);
         //window.location.href = url;

         //$.url(url)

       
         

         //   targetWindow.postMessage("1", "*"); 

         //function sendPost() {
         //    var iframeWin = document.getElementById("reportFrame").contentWindow;
         //    // 向该窗口发送消息        
         //    iframeWin.postMessage(document.getElementById("message").value,
         //        url);   
         //}

         // window.open(url, "_parent");
        




         //    window.onload = function () {
         //        var iframe = document.getElementById("reportFrame");
         //        var data = {
         //            db: "WMS!5e93!!5b58!!6c47!!603b!!62a5!!8868!!2f!MFA!8f66!!95f4!!2f!MFA!4fdd!!9669!!6760!!6c47!!603b!!62a5!!8868!.db",
         //            au_act: "login",
         //            adminv: "MES",
         //            passv: "123",

         //        };
         //        alert("ggg");
         //        iframe.contentWindow.postMessage(JSON.stringify(data), "http://10.60.101.97:8888/bi/Viewer?proc=1&action=viewer");
         //};
         //window.addEventListener("message", function (e) {
         //    alert("我接收到数据" + e.data);
         //}, false);
        


         //window.onload = function () {
         //    var iframeWin = document.getElementById("reportFrame");
         //    alert("aaaaa");
            

               

         //    string jsonStr = "{'action':'OpenDB','db':'http://10.60.101.97:8888/bi/Viewer?proc=1&action=viewer&db=WMS!5e93!!5b58!!6c47!!603b!!62a5!!8868!!2f!MFA!8f66!!95f4!!2f!MFA!4fdd!!9669!!6760!!6c47!!603b!!62a5!!8868!.db&au_act=login&adminv=MES&passv=123'}";
            


         //    entWindow.postMessage(jsonStr, "*");
         //    alert(a.data);

         //    iframeWin.contentWindow.postMessage(

         //        JSON.stringify({

         //            action: "OpenDB",
         //            //url: "http://10.60.101.97:8888/bi/Viewer?proc=1&action=viewer",
         //            db: url,
         //            //db: "http://10.60.101.97:8888/bi/Viewer?proc=1&action=viewer",

                     
         //            //db: "WMS!5e93!!5b58!!6c47!!603b!!62a5!!8868!!2f!MFA!8f66!!95f4!!2f!MFA!4fdd!!9669!!6760!!6c47!!603b!!62a5!!8868!.db",
         //            //au_act: "login",
         //            //adminv: "MES",
         //            //passv: "123",    

         //        }),

         //        "*",

         //    );
         //  //  this.document.body.appendChild(iframeWin);

         //    var id = "";
         //    window.addEventListener("message", (event) => {

         //        const data = event.data ? JSON.parse(event.data) : null;

         //        alert(data.action);

         //        if (data && data.action == "OpenedDBID") {

         //            console.log('Opened DB id: ', data.id);


         //            iframeWin.contentWindow.postMessage(

         //                JSON.stringify({

         //                    action: "RefreshDB",

         //                    id: data.id

         //                }),

         //                "*",

         //            );


         //        }

         //    });


         //}



        </script>
</form>
</body>