c“带Highchart的WPF Webbrowser,来自外部源的Javascript不工作”;此页上的脚本中出现错误";
我试图找出为什么我的图表没有出现在我的WPF网络浏览器中。 加载html文件时,出现以下错误: 我认为IE可能会阻止WPF WebBrowser中的Highchart(来自外部源的Javascript),因为当我尝试使用IE加载它时,我的页面受到限制,无法运行脚本或ActiveX控件: 我知道允许IE运行脚本或ActiveX控件,但我不知道如何在我的WPF WebBrowser中允许它 我试过使用a,但我不确定是否正确使用了它c“带Highchart的WPF Webbrowser,来自外部源的Javascript不工作”;此页上的脚本中出现错误";,javascript,c#,wpf,highcharts,webbrowser-control,Javascript,C#,Wpf,Highcharts,Webbrowser Control,我试图找出为什么我的图表没有出现在我的WPF网络浏览器中。 加载html文件时,出现以下错误: 我认为IE可能会阻止WPF WebBrowser中的Highchart(来自外部源的Javascript),因为当我尝试使用IE加载它时,我的页面受到限制,无法运行脚本或ActiveX控件: 我知道允许IE运行脚本或ActiveX控件,但我不知道如何在我的WPF WebBrowser中允许它 我试过使用a,但我不确定是否正确使用了它 <!-- saved from url=(0016)htt
<!-- saved from url=(0016)http://localhost -->
我还尝试了一些绝望的方法,比如将我的程序添加到:
HKEY\U当前\U用户\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE\U浏览器\U仿真\MyProgram.exe和MyProgram.vshost.exe,值0x00002af9
我真的很感谢你的帮助
我的html文件:
海图示例
Highcharts.chart('容器'{
图表:{
类型:“样条线”,
倒过来:是的
},
标题:{
文字:“按海拔高度划分的大气温度”
},
副标题:{
文字:“根据标准大气模型”
},
xAxis:{
相反:错,
标题:{
启用:对,
文字:“高度”
},
标签:{
格式化程序:函数(){
返回此值+公里数;
}
},
最大填充:0.05,
showLastLabel:true
},
亚克斯:{
标题:{
文字:“温度”
},
标签:{
格式化程序:函数(){
返回此值+“°”;
}
},
线宽:2
},
图例:{
已启用:false
},
工具提示:{
headerFormat:“{series.name}
”,
点格式:“{point.x}km:{point.y}°C”
},
打印选项:{
样条曲线:{
标记:{
启用:false
}
}
},
系列:[{
名称:“温度”,
数据:[[0,15],[10,-50],[20,-56.5],[30,-46.5],[40,-22.1],
[50, -2.5], [60, -27.7], [70, -55.7], [80, -76.5]]
}]
});
好的,这对我来说很好
我添加了
。我还在VisualStudio中本地加载了HTML文件,将其添加到项目中,并将其设置为copy always
。我也没有在我的机器上做任何注册表调整
C#文件
HTML文件
<!DOCTYPE HTML>
<!-- saved from url=(0016)http://localhost -->
<html>
<head>
<meta http-equiv="x-ua-compatible" content="IE=11">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Highcharts Example</title>
<style type="text/css">
</style>
</head>
<body>
<script src="https://code.highcharts.com/highcharts.src.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<div id="container" style="min-width: 310px; height: 400px; max-width: 600px; margin: 0 auto"></div>
<script type="text/javascript">
Highcharts.chart("container", {
chart: {
type: "spline",
inverted: true
},
title: {
text: "Atmosphere Temperature by Altitude"
},
subtitle: {
text: "According to the Standard Atmosphere Model"
},
xAxis: {
reversed: false,
title: {
enabled: true,
text: "Altitude"
},
labels: {
formatter: function () {
return this.value + "km";
}
},
maxPadding: 0.05,
showLastLabel: true
},
yAxis: {
title: {
text: "Temperature"
},
labels: {
formatter: function () {
return this.value + "°";
}
},
lineWidth: 2
},
legend: {
enabled: false
},
tooltip: {
headerFormat: "<b>{series.name}</b><br/>",
pointFormat: "{point.x} km: {point.y}°C"
},
plotOptions: {
spline: {
marker: {
enable: false
}
}
},
series: [{
name: "Temperature",
data: [[0, 15], [10, -50], [20, -56.5], [30, -46.5], [40, -22.1],
[50, -2.5], [60, -27.7], [70, -55.7], [80, -76.5]]
}]
});
</script>
</body>
</html>
海图示例
图表(“容器”{
图表:{
类型:“样条曲线”,
倒过来:是的
},
标题:{
正文:“按高度划分的大气温度”
},
副标题:{
正文:“根据标准大气模式”
},
xAxis:{
相反:错,
标题:{
启用:对,
文字:“高度”
},
标签:{
格式化程序:函数(){
返回此值+公里数;
}
},
最大填充:0.05,
showLastLabel:true
},
亚克斯:{
标题:{
正文:“温度”
},
标签:{
格式化程序:函数(){
返回此参数。值+“°”;
}
},
线宽:2
},
图例:{
已启用:false
},
工具提示:{
headerFormat:“{series.name}
”,
pointFormat:“{point.x}km:{point.y}°C”
},
打印选项:{
样条曲线:{
标记:{
启用:false
}
}
},
系列:[{
名称:“温度”,
数据:[[0,15],[10,-50],[20,-56.5],[30,-46.5],[40,-22.1],
[50, -2.5], [60, -27.7], [70, -55.7], [80, -76.5]]
}]
});
它也给出了一个很好的结果。
如果此代码无法解决您的问题。我怀疑您的本地Intranet安全区域设置需要更改。当您执行
alert(navigator.userAgent)时,它会说什么代码>?highchart js是否使用websockets?它会像Gecko一样显示“Mozilla/5.0(Windows NT 6.1;WOW64;Trident/7.0;rv:11.0)”。您是否尝试过本地机器锁定注册表设置?不,我还没有尝试,我应该在其中添加MyProgram.exe和MyProgram.vshost.exe吗
<!DOCTYPE HTML>
<!-- saved from url=(0016)http://localhost -->
<html>
<head>
<meta http-equiv="x-ua-compatible" content="IE=11">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Highcharts Example</title>
<style type="text/css">
</style>
</head>
<body>
<script src="https://code.highcharts.com/highcharts.src.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<div id="container" style="min-width: 310px; height: 400px; max-width: 600px; margin: 0 auto"></div>
<script type="text/javascript">
Highcharts.chart("container", {
chart: {
type: "spline",
inverted: true
},
title: {
text: "Atmosphere Temperature by Altitude"
},
subtitle: {
text: "According to the Standard Atmosphere Model"
},
xAxis: {
reversed: false,
title: {
enabled: true,
text: "Altitude"
},
labels: {
formatter: function () {
return this.value + "km";
}
},
maxPadding: 0.05,
showLastLabel: true
},
yAxis: {
title: {
text: "Temperature"
},
labels: {
formatter: function () {
return this.value + "°";
}
},
lineWidth: 2
},
legend: {
enabled: false
},
tooltip: {
headerFormat: "<b>{series.name}</b><br/>",
pointFormat: "{point.x} km: {point.y}°C"
},
plotOptions: {
spline: {
marker: {
enable: false
}
}
},
series: [{
name: "Temperature",
data: [[0, 15], [10, -50], [20, -56.5], [30, -46.5], [40, -22.1],
[50, -2.5], [60, -27.7], [70, -55.7], [80, -76.5]]
}]
});
</script>
</body>
</html>