允许用户在网站上运行脚本

时间:2014-02-25 09:14:36

标签: javascript html

我们的一位客户问我们是否可以选择允许他们在我们的网站上运行javascript以观看直播视频。我们有一个控制面板,我们的客户可以控制他们的传感器。

他们问道:“是否可以添加嵌入式代码作为添加实时视频的选项,因为这样可以选择控制轴摄像机图像的显示方式。 例如从Axis Camera HTML设置示例我们得到:“

<SCRIPT LANGUAGE="JavaScript">
// Set the BaseURL to the URL of your camera
var BaseURL = "http://r2.mike.com/";
// DisplayWidth & DisplayHeight specifies the displayed width &
height of the image.
// You may change these numbers, the effect will be a stretched or a
shrunk image
var DisplayWidth = "352";
var DisplayHeight = "288";
// This is the path to the image generating file inside the camera
itself
var File = "axis-cgi/mjpg/video.cgi?resolution=CIF";
// No changes required below this point
var output = "";
if ((navigator.appName == "Microsoft Internet Explorer")
&&
   (navigator.platform != "MacPPC") &&
(navigator.platform != "Mac68k"))
{
  // If Internet Explorer under Windows then use ActiveX 
  output  = '<OBJECT ID="Player" width='
  output += DisplayWidth;
  output += ' height=';
  output += DisplayHeight;
  output += '
CLASSID="CLSID:DE625294-70E6-45ED-B895-CFFA13AEB044" ';
  output += 'CODEBASE="';
  output += BaseURL;
  output += 'activex/AMC.cab#version=5,6,2,4">';
  output += '<PARAM NAME="MediaURL" VALUE="';
  output += BaseURL;
  output += File + '">';
  output += '<param name="MediaType"
value="mjpeg">';
  output += '<param name="ShowStatusBar"
value="0">';
  output += '<param name="ShowToolbar"
value="0">';
  output += '<param name="AutoStart"
value="1">';
  output += '<param name="StretchToFit"
value="1">';
  // Remove the // for the ptz settings below to use the code for
click-in-image. 
     //  output += '<param
name="PTZControlURL" value="';
     //  output += BaseURL;
     //  output +=
'/axis-cgi/com/ptz.cgi?camera=1">';
     //  output += '<param
name="UIMode" value="ptz-relative">'; // or
"ptz-absolute"
  output += '<BR><B>Axis Media
Control</B><BR>';
  output += 'The AXIS Media Control, which enables you ';
  output += 'to view live image streams in Microsoft Internet';
  output += ' Explorer, could not be registered on your computer.';
  output += '<BR></OBJECT>';
} else {
  // If not IE for Windows use the browser itself to display
  theDate = new Date();
  output  = '<IMG SRC="';
  output += BaseURL;
  output += File;
  output += '&dummy=' + theDate.getTime().toString(10);
  output += '" HEIGHT="';
  output += DisplayHeight;
  output += '" WIDTH="';
  output += DisplayWidth;
  output += '" ALT="Camera Image">';
}
document.write(output);
document.Player.ToolbarConfiguration =
"play,+snapshot,+fullscreen"

// Remove the // below to use the code for Motion Detection. 
  // document.Player.UIMode = "MDConfig";
  // document.Player.MotionConfigURL =
"/axis-cgi/operator/param.cgi?ImageSource=0"
  // document.Player.MotionDataURL =
"/axis-cgi/motion/motiondata.cgi";
</SCRIPT>

是否有一种安全的方式允许用户在网站上运行javascript?

由于

0 个答案:

没有答案