homer3018 | Bonjour,
je me permet de faire remonter ce topic, car je suis dans la même situation, page vierge affichée avec chrome, alors que tout fonctionne avec IE, quelques bugs d'affichages avec FF mais ça c'est rien, il faut que ça fonctionne avec chrome.
je ne suis pas très calé en JS, soyez indulgent
Voici le code html de ma page :
Code :
- <frameset rows=0,110,* border=0><frame name=JavaScriptFrame src=JavaScript.html><frame name=TopFrame><frame name=BottomFrame></frameset>
|
et voici javascript.html :
<script>
Code :
- CamsIPs = new Array();
- CamsNames = new Array();
- var NumberOfCams = 4;
- var IndividualScanTimeInterval = 1000; //In milliseconds
- var GroupsScanTimeInterval = 1000; //In milliseconds
- //Camera IP + port# in video server
- CamsIPs[1]="192.168.0.99";
- CamsIPs[2]="";
- CamsIPs[3]="";
- CamsIPs[4]="";
- // Camera Name
- CamsNames[1]="1; 1";
- CamsNames[2]="1; 2";
- CamsNames[3]="1; 3";
- CamsNames[4]="1; 4";
- var URLend = '/axis-cgi/mjpg/video.cgi?resolution=352x240&color=1&compression=0&fps=3';
- var URLend1 = '/axis-cgi/mjpg/video.cgi?resolution=704x240&color=1&compression=0&fps=3';
- var NumberOfGroupsOfCams = 1;//5;
- var GroupOfCamsNumbers1 = new Array(1, 2, 3, 4);
- //var GroupOfCamsNumbers2 = new Array(11, 12, 13, 14, 15, 16, 17, 18, 19, 20);
- //var GroupOfCamsNumbers3 = new Array(21, 22, 23, 24, 25, 26, 27, 28, 29, 30);
- //var GroupOfCamsNumbers4 = new Array(31, 32, 33, 34, 35, 36, 37, 38, 39, 40);
- //var GroupOfCamsNumbers5 = new Array(41, 42, 43, 44, 45, 46, 47, 48, 49, 50);
- //var GroupOfCamsNumbers6 = new Array(51, 52, 53, 54, 55, 56, 57, 58, 59, 60);
- //var GroupOfCamsNumbers7 = new Array(61, 62, 63, 64, 65, 66, 67, 68, 69, 70);
- //var GroupOfCamsNumbers8 = new Array(71, 72, 73, 74, 75, 76, 77, 78, 79, 80);
- //var GroupOfCamsNumbers9 = new Array(81, 82, 83, 84, 85);
- //var GroupOfCamsNumbers10 = new Array(86, 87, 88, 89, 90);
- //var GroupOfCamsNumbers11 = new Array(1, 11, 21, 31, 41, 51, 61, 71, 81, 86, 2, 12, 22, 32, 42, 52, 62, 72, 82, 87);
- //var GroupOfCamsNumbers12 = new Array(3, 13, 23, 33, 43, 53, 63, 73, 83, 88, 4, 14, 24, 34, 44, 54, 64, 74, 84, 89);
- //var GroupOfCamsNumbers13 = new Array(5, 15, 25, 35, 45, 55, 65, 75, 85, 90, 6, 16, 26, 36, 46, 56, 66, 76, 0, 0, 7, 17, 27, 37, 47, 57, 67, 77, 0, 0);
- //var GroupOfCamsNumbers14 = new Array(8, 18, 28, 38, 48, 58, 68, 78, 0, 0, 9, 19, 29, 39, 49, 59, 69, 79, 0, 0, 10, 20, 30, 40, 50, 60, 70, 80, 0, 0);
- //var GroupOfCamsNumbers15 = new Array(91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104);
- var GroupsOfCamsNumbers = new Array(
- GroupOfCamsNumbers1);//,
- //GroupOfCamsNumbers2,
- //GroupOfCamsNumbers3,
- //GroupOfCamsNumbers4,
- //GroupOfCamsNumbers5,
- //GroupOfCamsNumbers6,
- //GroupOfCamsNumbers7,
- //GroupOfCamsNumbers8,
- //GroupOfCamsNumbers9,
- //GroupOfCamsNumbers10,
- //GroupOfCamsNumbers11,
- //GroupOfCamsNumbers12,
- //GroupOfCamsNumbers13,
- //GroupOfCamsNumbers14,
- //GroupOfCamsNumbers15);
- var NbRows = 3;
- var NbCols = 4;
- var CamNumber = 1;
- var GroupOfCamNumber = 1;
- var Timeout = 0;
- var AutoScan = 0;
- function WriteMenuInTopFrame(SelectedView)
- {
- top.TopFrame.document.write('<style>a:visited{color:orange}body{margin:3}</style><body bgcolor=0><center><font face=Arial color=white size=4><img src="Logo.png" align=absmiddle>   <b>');
- if (SelectedView != -3)
- top.TopFrame.document.write('<a href="JavaScript:top.JavaScriptFrame.WriteMenuInTopFrame(-3)">');
- top.TopFrame.document.write('Ciclico individual<a> | ');
- if (SelectedView != -2)
- top.TopFrame.document.write('<a href="JavaScript:top.JavaScriptFrame.WriteMenuInTopFrame(-2)">');
- top.TopFrame.document.write('Ciclico por lineas<br>');
- for (GroupOfCam=1; GroupOfCam<=NumberOfGroupsOfCams; GroupOfCam++) {
- top.TopFrame.document.write('<a> ');
- if (GroupOfCam != SelectedView) top.TopFrame.document.write('<a href="JavaScript:top.JavaScriptFrame.WriteMenuInTopFrame(' + GroupOfCam + ')">');
- if (GroupOfCam < 11) top.TopFrame.document.write('Linea ' + GroupOfCam);
- if (GroupOfCam == 15) top.TopFrame.document.write('Celdas Columnares');
- }
- top.TopFrame.location.reload();
- clearTimeout(Timeout);
- // Ciclico Individual
- if (SelectedView == -3) {AutoScan = 1; NbCols=4; NbRows=2; WriteBottomFrameForOneCam(0)}
- // Ciclico por linea
- if (SelectedView == -2) {AutoScan = 1; NbCols=4; NbRows=3; WriteBottomFrameForOneGroupOfCams(GroupsOfCamsNumbers[0], NbCols, NbRows)}
- // Lineas
- if (SelectedView == 1) {AutoScan = 0; NbCols=4; NbRows=3; WriteBottomFrameForOneGroupOfCams(GroupsOfCamsNumbers[SelectedView-1], NbCols, NbRows)}
- if (SelectedView == 2) {AutoScan = 0; NbCols=4; NbRows=3; WriteBottomFrameForOneGroupOfCams(GroupsOfCamsNumbers[SelectedView-1], NbCols, NbRows)}
- if (SelectedView == 3) {AutoScan = 0; NbCols=4; NbRows=3; WriteBottomFrameForOneGroupOfCams(GroupsOfCamsNumbers[SelectedView-1], NbCols, NbRows)}
- if (SelectedView == 4) {AutoScan = 0; NbCols=4; NbRows=3; WriteBottomFrameForOneGroupOfCams(GroupsOfCamsNumbers[SelectedView-1], NbCols, NbRows)}
- if (SelectedView == 5) {AutoScan = 0; NbCols=4; NbRows=3; WriteBottomFrameForOneGroupOfCams(GroupsOfCamsNumbers[SelectedView-1], NbCols, NbRows)}
- if (SelectedView == 6) {AutoScan = 0; NbCols=4; NbRows=3; WriteBottomFrameForOneGroupOfCams(GroupsOfCamsNumbers[SelectedView-1], NbCols, NbRows)}
- if (SelectedView == 7) {AutoScan = 0; NbCols=4; NbRows=3; WriteBottomFrameForOneGroupOfCams(GroupsOfCamsNumbers[SelectedView-1], NbCols, NbRows)}
- if (SelectedView == 8) {AutoScan = 0; NbCols=4; NbRows=3; WriteBottomFrameForOneGroupOfCams(GroupsOfCamsNumbers[SelectedView-1], NbCols, NbRows)}
- if (SelectedView == 9) {AutoScan = 0; NbCols=4; NbRows=2; WriteBottomFrameForOneGroupOfCams(GroupsOfCamsNumbers[SelectedView-1], NbCols, NbRows)}
- if (SelectedView == 10) {AutoScan = 0; NbCols=4; NbRows=2; WriteBottomFrameForOneGroupOfCams(GroupsOfCamsNumbers[SelectedView-1], NbCols, NbRows)}
- // Celdas individuales
- //if (SelectedView == 11) {AutoScan = 0; NbCols=10}
- //if (SelectedView == 12) {AutoScan = 0; NbCols=10}
- //if (SelectedView == 13) {AutoScan = 0; NbCols=10}
- //if (SelectedView == 14) {AutoScan = 0; NbCols=10}
- //Columnas
- if (SelectedView == 15) {AutoScan = 0; NbCols=4; NbRows=4; WriteBottomFrameForOneGroupOfCams(GroupsOfCamsNumbers[SelectedView-1], NbCols, NbRows)}
- }
- function WriteBottomFrameForOneGroupOfCams(CamsNumbers, NbCols, NbRows)
- {
- var HTMLoutput = '<style>a:link{color:orange}a:visited{color:orange}body{margin:0}td{text-align:center}</style><body bgcolor=0><font face=Arial color=white><table border=0 bordercolor=gray cellspacing=0 cellpadding=4 width=100%>';
- for(Row=0; Row<NbRows; Row++)
- {
- HTMLoutput += '<tr>';
-
- for (Col=1; Col<=NbCols; Col++)
- {
- if (CamsNumbers[NbCols*Row+Col-1] > 0)
- {
- if (CamsNumbers[NbCols*Row+Col-1] < 91)
- {
- // If Internet Explorer under Windows then use ActiveX
- HTMLoutput += '<td><object id=Player width=';
- HTMLoutput += ((top.document.body.offsetWidth-5)/NbCols - 20);
- // HTMLoutput += ((top.document.body.offsetWidth-5)/NbCols - 10); Original width
- HTMLoutput += ' height=';
- HTMLoutput += ((top.document.body.offsetWidth-5)/NbCols - 20)*3/4;
- // HTMLoutput += ((top.document.body.offsetHeight-120)/NbRows - 38); Original height
- HTMLoutput += ' CLASSID="CLSID:745395C8-D0E1-4227-8586-624CA9A10A8D" ';
- HTMLoutput += 'CODEBASE=http://';
- HTMLoutput += CamsIPs[CamsNumbers[NbCols*Row+Col-1]];
- HTMLoutput += '/activex/AMC.cab#version=4,1,4,0>';
- HTMLoutput += '<param name=MediaURL value=http://';
- HTMLoutput += CamsIPs[CamsNumbers[NbCols*Row+Col-1]];
- HTMLoutput += URLend + '>';
- HTMLoutput += '<param name=MediaType value=mjpeg-unicast>';
- HTMLoutput += '<param name=AutoStart value=1>';
- HTMLoutput += '<param name=StretchToFit value=1>';
- HTMLoutput += '</object>'
- }
- if (CamsNumbers[NbCols*Row+Col-1] > 90)
- {
- // If Internet Explorer under Windows then use ActiveX
- HTMLoutput += '<td><object id=Player width=';
- HTMLoutput += ((top.document.body.offsetWidth-5)/NbCols - 20);
- // HTMLoutput += ((top.document.body.offsetWidth-5)/NbCols - 15); Original width
- HTMLoutput += ' height=';
- HTMLoutput += ((top.document.body.offsetWidth-5)/NbCols - 20)*1/2;
- // HTMLoutput += ((top.document.body.offsetHeight-120)/NbRows - 20); Original height
- HTMLoutput += ' CLASSID="CLSID:745395C8-D0E1-4227-8586-624CA9A10A8D" ';
- HTMLoutput += 'CODEBASE=http://';
- HTMLoutput += CamsIPs[CamsNumbers[NbCols*Row+Col-1]];
- HTMLoutput += '/activex/AMC.cab#version=4,1,4,0>';
- HTMLoutput += '<param name=MediaURL value=http://';
- HTMLoutput += CamsIPs[CamsNumbers[NbCols*Row+Col-1]];
- HTMLoutput += URLend + '>';
- HTMLoutput += '<param name=MediaType value=mjpeg-unicast>';
- HTMLoutput += '<param name=AutoStart value=1>';
- HTMLoutput += '<param name=StretchToFit value=1>';
- HTMLoutput += '</object>'
- }
- }
- else
- HTMLoutput += '<td> '
- } // End of first loop on cols (cams videos)
- HTMLoutput += '<tr>';
- for (Col=1; Col<=NbCols; Col++)
- {
- if (CamsNumbers[NbCols*Row+Col-1] > 0)
- {
- HTMLoutput += '<td><a href="JavaScript:top.JavaScriptFrame.WriteBottomFrameForOneCam(' + CamsNumbers[NbCols*Row+Col-1] + ')"><b>' + CamsNames[CamsNumbers[NbCols*Row+Col-1]]
- }
- else
- HTMLoutput += '<td> '
- } // End of second loop on cols (cams names)
- } // End of loop on rows
- HTMLoutput += '</table>';
- top.BottomFrame.document.write(HTMLoutput);
- top.BottomFrame.location.reload();
- if (GroupOfCamNumber==10) {GroupOfCamNumber=0;}
- GroupOfCamNumber++;
- if (GroupOfCamNumber>NumberOfGroupsOfCams)
- GroupOfCamNumber=9;
- if (AutoScan == 1)
- Timeout = setTimeout("WriteBottomFrameForOneGroupOfCams(GroupsOfCamsNumbers[GroupOfCamNumber-1], NbCols, NbRows)",GroupsScanTimeInterval);
- if (AutoScan == 2)
- Timeout = setTimeout("WriteBottomFrameForOneGroupOfCams(GroupOfCamsNumbers13, 4, 4)", IndividualScanTimeInterval);
- }
- function StopAutoScan()
- {
- clearTimeout(Timeout);
- AutoScan = 0;
- WriteMenuInTopFrame(0)
- }
- function WriteBottomFrameForOneCam(NewCamNumber)
- {
- if (NewCamNumber > 0)
- {
- CamNumber=NewCamNumber;
- StopAutoScan()
- }
- top.BottomFrame.document.write(
- '<style>a:link{color:orange}a:visited{color:orange}body{margin:0}</style><body bgcolor=0><center><object id=Player width='
- + (top.document.body.offsetHeight-150)*4/3
- + ' height=' + (top.document.body.offsetHeight-150)
- + ' CLASSID="CLSID:745395C8-D0E1-4227-8586-624CA9A10A8D" CODEBASE=http://'
- + CamsIPs[CamNumber]
- + '/activex/AMC.cab#version=4,1,4,0><param name=MediaURL value=http://'
- + CamsIPs[CamNumber]
- + URLend1
- + '><param name=MediaType value=mjpeg-unicast><param name=AutoStart value=1><param name=StretchToFit value=1></object><font size=1><br><font face=Arial size=5 color=orange><b><a href=JavaScript:top.JavaScriptFrame.StopAutoScan()>'
- + CamsNames[CamNumber]);
- top.BottomFrame.location.reload();
- CamNumber++;
- if (CamNumber>NumberOfCams)
- {
- CamNumber=1;
- }
- if (AutoScan == 1)
- Timeout = setTimeout("WriteBottomFrameForOneCam(0)",IndividualScanTimeInterval)
- }
- WriteMenuInTopFrame(-3)
- </script>
|
Voici ce que me donne la console de dev de Chrome : Unsafe JavaScript attempt to access frame with URL about:blank from frame with URL file:///C Users/ ..... /Page%20HTML/JavaScript.html. Domains, protocols and ports must match.
JavaScript.html:290Uncaught TypeError: Cannot call method 'write' of undefined ( ligne 70)
Merci d'avance pour votre aide! |