Iframe does not render properly
So I'm attempting to run a webpage that shows security camera feeds for a client. However it does not render properly at all and only shows the background. I have a feeling it has to do with a limitation of the iframe tag, since using other iframe testing gadgets online I get the same results. Other clients are using camera feeds with a different interface and my solution works fine for them. Are there any alternatives to iframe?
edit: The page a开发者_JS百科ctually renders perfectly fine when being visited directly, and not through an iframe.
edit2: By popular request here is the source for the security feed site. I did not post my iframe code, since no matter what I use for iframe it will not display.
<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>
The page actually renders perfectly fine when being visited directly, and not through an iframe.
The only thing I can think of that the page has a frame busting technique.
You can read a little about it here.
I can't help you much more without the code!
精彩评论