2010-12-22 115 views
1

所以我试图运行一个显示客户端安全摄像头源的网页。但是它不能正确渲染,只显示背景。我有一种感觉,它与iframe标记的限制有关,因为在线使用其他iframe测试小工具我得到相同的结果。其他客户端使用不同接口的摄像头源,我的解决方案对他们来说工作正常。有iframe的替代品吗?Iframe无法正确呈现

编辑:页面直接访问时实际呈现完美,而不是通过iframe。

edit2:此处的流行要求是安全Feed网站的来源。我没有发布我的iframe代码,因为无论我用于iframe,它都不会显示。

<html> 

<head> 

<meta http-equiv="content-type" content="text/html; charset=UTF-8"> 

<meta http-equiv="expires" content="-1"> 

<title>:::</title> 

<script language="JavaScript" src="/js/lgSource.js"></script> 

<script language="JavaScript" src="/js/data_init.js"></script> 

<script language="javascript" src="/js/AVUtility.js"></script> 



<script language="JavaScript"> 

var d = document ; 

d.write("<frameset frameSpacing=0 rows='37,*' frameBorder='no' >") ; 

d.write(" <frame name='ban' src='' scrolling='no'>") ; 

d.write(" <frameset frameSpacing=0 frameBorder='no' cols='*,195'>") ; 

d.write("  <frame name='main' src='home.htm' scrolling='auto'>") ; 

d.write("  <frame name='left' src='' noResize scrolling='no'>") ; 

d.write(" </frameset>") ; 

d.write("</frameset>") ; 

d.write("<noframes><body><p>no frame</p></body></noframes>") ; 



var httpObj,httpObj2,httpObj3; 

//alert("Code in NFS. H264 \n\n charset=utf-8"); 

//top.dt.user.SupportLG = "ENGLISH&CHINESE&" 

loadSupportLanguage(); 

//loadUserPwd(); 



function loadSupportLanguage() 

{ 

    httpObj3 = createHttpRequestObj(); 

    requestData = "http://"+getURL()+"/cgi-bin/nobody/Machine.cgi?action=get_capability"; 

    httpObj3.onreadystatechange = updSL; 

    requestCgiParam(httpObj3, requestData); 

} 



function updSL() 

{ 

    if (httpObj3.readyState == 4 && httpObj3.status == 200) 

    { 

     var objStr = new Object(); 

     objStr.strSrc = httpObj3.responseText; 



     if (GetCgiParam(objStr,"Language.Support=") == 1) 

      if (objStr.strGet != "") 

       top.dt.user.SupportLG = objStr.strGet; 



     loadUserPwd(); 

    } 

} 



function loadUserPwd() 

{ 

    httpObj = createHttpRequestObj(); 

    requestData = "http://"+getURL()+"/cgi-bin/guest/UserInfo.cgi?action=query";  

    httpObj.onreadystatechange = updUserPwd; 

    requestCgiParam(httpObj, requestData); 

} 



function updUserPwd() 

{ 

    if (httpObj.readyState == 4 && httpObj.status == 200) 

    { 

     var objStr = new Object(); 

     objStr.strSrc = httpObj.responseText; 



     if (GetCgiParam(objStr, "Username=") == 1) 

      top.dt.user.username = objStr.strGet; 



     if (GetCgiParam(objStr, "Password=") == 1) 

      top.dt.user.password = objStr.strGet; 



     loadLogin(); 

    } 

} 



function loadLogin() 

{ 

    httpObj2 = createHttpRequestObj(); 

    requestData = "http://"+getURL()+"/cgi-bin/guest/Login.cgi?rnd="+Math.random(); 

    httpObj2.onreadystatechange = updLogin; 

    httpObj2.open("get", requestData, true); 

    httpObj2.send(null); 

} 



function updLogin() 

{ 

    if (httpObj2.readyState == 4 && httpObj2.status == 200) 

    { 

     var objStr = new Object(); 

     objStr.strSrc = httpObj2.responseText; 



     if (GetCgiParam(objStr,"Server-Language=") == 1) 

     { 

      if(objStr.strGet.toUpperCase() == "CHINESE") 

       top.dt.user.language = 2; 

      else if(objStr.strGet.toUpperCase() == "GREEK") 

       top.dt.user.language = 3; 

      else 

       top.dt.user.language = 1; 

     } 



     if (GetCgiParam(objStr, "Video-System=") == 1) 

      top.dt.user.VideoSystem = objStr.strGet; 



     if (GetCgiParam(objStr, "User-Level=") == 1) 

      top.dt.user.ulevel = objStr.strGet; 



     if (GetCgiParam(objStr, "Product-ShortName=") == 1) 

     { 

      if(objStr.strGet == "V_Indep") 

       top.dt.user.IndepFlag = true; 

     } 



     //top.dt.user.NatSupport = true; 

     //top.dt.user.PosSupport = true; 

     if (GetCgiParam(objStr, "Capability=") == 1) 

     { 

      tmpStr = objStr.strGet.split(","); 

      if(tmpStr.length==4){ 

       if(parseInt(tmpStr[3],16)&0x01) 

        top.dt.user.isDvrPtz = true; 



       if(parseInt(tmpStr[2],16)&0x01) 

        top.dt.user.DvrHaSupport = true; // HA 



       if(parseInt(tmpStr[2],16)&0x02) 

        top.dt.account.NotifySys = true; //3G Notify 



       if(parseInt(tmpStr[2],16)&0x04) 

        top.dt.user.NatSupport = true; //NAT 



       if(parseInt(tmpStr[2],16)&0x08) 

        top.dt.user.RfidSupport = true; //RFID 



       if(parseInt(tmpStr[1],16)&0x01) 

        top.dt.user.PosSupport = true; //POS 



      } 

     } 



     if (GetCgiParam(objStr, "Product-ID-Minor=") == 1) 

     { 

      top.dt.user.ProductID = objStr.strGet; 

      var pid = objStr.strGet; 



      // Video Channel (default: 4 ch) 

      if(pid == "787" || pid == "718" || pid == "616" || pid == "757" || pid == "677" || pid == "678" || pid == "DG1648" || pid == "798"){ 

       top.dt.user.dvrCh = 16; 

      } 

      else if (pid == "785" || pid == "608" || pid == "716" || pid == "755" || pid == "675" || pid == "676" || pid == "DG0824" || pid == "796"){ 

       top.dt.user.dvrCh = 8; 

      } 

      else if (pid == "783" || pid == "604" || pid == "604F" || pid == "714" || pid == "724" || pid == "DG0412" || pid == "763" || pid == "764" || pid == "760A" || pid == "761A" || pid == "041"){ 

       top.dt.user.dvrCh = 4; 

      } 

      else{ 

       top.dt.user.dvrCh = 4; /* default 4 ch */ 

      } 



      // Audio Channel 

      if(pid == "DG0824" || pid == "608" || pid == "DG1648" || pid == "616" || pid == "718" || pid == "757" || pid == "755" || pid == "675" || pid == "676" || pid == "677" || pid == "678" || pid == "724" || pid == "764" || pid == "673" || pid == "674" || pid == "683" || pid == "796" || pid == "798"){ 

       top.dt.user.soundCh = 4; 

      } 

      else if (pid == "732E" || pid == "DG0412" || pid == "714"){ 

       top.dt.user.soundCh = 2; 

      } 

      else if (pid == "733" || pid == "944" || pid == "945" || pid == "946" || pid == "311" || pid == "321" || pid == "202" || pid == "212" || pid == "604F" || pid == "203" || pid == "671" || pid == "672" || pid == "681"){ 

       top.dt.user.soundCh = 1; 

      } 

      else{ 

       top.dt.user.soundCh = 0; 

      } 



      //Top-Page 

      if(top.dt.user.ulevel != "SUPERVISOR" || pid == "203" || pid == "763") 

       top.dt.user.topSrc = "/top2.htm"; 

      else 

       top.dt.user.topSrc = "/top.htm"; 



      //show Left-Page 

      if(pid == "311" || pid == "321"){ 

       top.dt.user.leftSrc = "/left_ipcam.htm"; 

       top.dt.user.confSrc = "/left_ipcam_config.htm"; 

       top.dt.user.ProductType = "IP CAMERA"; 

       top.dt.user.isAutomoveSupport = true; 

      } 

      else if(pid == "203"){ 

       top.dt.user.leftSrc = "/left_ipcam_h264.htm"; 

       top.dt.user.ProductType = "IP CAMERA"; 

      } 

      else{ 

       if(pid == "763"){ 

        top.dt.user.leftSrc = "/left_home763.htm"; 

       }else if(pid == "798" || pid == "796"){ 

        top.dt.user.leftSrc = "/left_home16ch.htm"; 

       } 

       else{ 

        top.dt.user.leftSrc = "/left_home.htm"; 

       } 

       top.dt.user.confSrc = "/left_config.htm"; 

       top.dt.user.ProductType = "DVR"; 

      } 



      //show Title 

      if(pid == "764" || pid == "671" || pid == "672" || pid == "673" || pid == "674" || pid == "681" || pid == "683" || pid == "203" || pid == "796" || pid == "798" || pid == "041"){ 

       top.dt.user.MediaType = "H264"; 

       document.title = "H264 "+ top.dt.user.ProductType; 

      } 

      else 

       document.title = "MPEG4 "+ top.dt.user.ProductType; 



      if(top.dt.user.ulevel == "SUPERVISOR") 

       if(top.dt.user.ProductType == "DVR") 

        loadRecImageSize(); 

       else 

        chkNatFirstUse(); 

      else 

       loadMainPage(); 

     } 

    } 

} 



function loadRecImageSize() 

{ 

    httpObj = createHttpRequestObj(); 

    var requestData = "http://"+getURL()+"/cgi-bin/user/Config.cgi?action=get&category=DVR.Record.*"; 

    httpObj.onreadystatechange = updRecImageSize; 

    requestCgiParam(httpObj, requestData); 

} 



function updRecImageSize() 

{ 

    if (httpObj.readyState == 4 && httpObj.status == 200) 

    { 

     var objStr = new Object(); 

     objStr.strSrc = httpObj.responseText; 



     if (GetCgiParam(objStr,"ImageSize=") == 1){ 

      top.dt.user.DVR_Record_ImageSize = objStr.strGet; 

      chkNatFirstUse(); 

     } 

    } 

} 



function chkNatFirstUse() 

{ 

    httpObj = createHttpRequestObj(); 

    var requestData = "http://"+getURL()+"/cgi-bin/user/Config.cgi?action=get&category=Network.NAT.*"; 

    httpObj.onreadystatechange = updNatFirstUse; 

    requestCgiParam(httpObj, requestData); 

} 



function updNatFirstUse() 

{ 

    if (httpObj.readyState == 4 && httpObj.status == 200) 

    { 

     var objStr = new Object(); 

     objStr.strSrc = httpObj.responseText; 



     var FirstUseNatFlag = false; 

     if (GetCgiParam(objStr,"FirstUse=") == 1) 

      if(objStr.strGet == "YES") 

       FirstUseNatFlag = true; 



     if (GetCgiParam(objStr,"Hostname=") == 1) 

      top.dt.user.NatName = objStr.strGet; 



     if(FirstUseNatFlag) 

      showNatFirstUseWeb(); 

     else 

      loadMainPage(); 

    } 

} 



function showNatFirstUseWeb() 

{ 

    top.ban.location.replace("/top2.htm"); 

    top.left.location.replace("/left_empty.htm"); 

    top.main.location.replace("/combo/nat_firstuse.htm"); 

} 



function loadMainPage() 

{ 

    top.dt.user.mainSrc = "/home.htm"; 

    top.ban.location.replace(top.dt.user.topSrc); 

    top.left.location.replace(top.dt.user.leftSrc); 

} 

</script> 

</html> 
+0

iframe标记不会改变浏览器渲染包含页面的能力。如果它不在iframe中呈现,它将不会呈现。 – Vetsin 2010-12-22 18:17:42

+0

那就是我的想法。但它能够很好地直接访问它。而且根本无法在iframe中呈现。这是在多个浏览器和多台机器上检查的。 – Matt 2010-12-22 18:21:43

+0

也许我错了,该代码是使用框架和JavaScript引用它们。也许JavaScript和iframe中的框架之间存在渲染问题? – Vetsin 2010-12-22 19:41:26

回答

1

页实际上完全呈现不通过iframe时直接访问 罚款,并 。

我能想到的唯一的事情就是该页面有一个帧破坏技术。

你可以看一下它here

没有代码,我无法帮到你!

0

如果您可以,请尝试发布您的代码。我很乐意看一看。