[英]JavaScript Won't Load
I'm a noob - please be gentle for this stupid question. 我是个菜鸟 - 请对这个愚蠢的问题保持温和。
I'm writing an extremely basic application that serves as a C# wrapper for a Browser-Based chat window: https://www.purechat.com/w/cvadob . 我正在编写一个非常基本的应用程序,作为基于浏览器的聊天窗口的C#包装器: https : //www.purechat.com/w/cvadob 。 Whenever I launch this code:
每当我启动此代码时:
webBrowser1.Navigate("https://www.purechat.com/w/cvadob");
The page will spit out Script Errors and will not load anything (webBrowser1 stays white). 该页面将吐出脚本错误,并且不会加载任何内容(webBrowser1保持白色)。 I stopped the errors with:
我用以下方法阻止了错误:
webBrowser1.ScriptErrorsSuppressed = true;
but I have not been able to get the JavaScript heavy page to load. 但我无法加载JavaScript重页。
Does anyone have any experience with this? 有人对这个有经验么? I tried downloading several open-source browsers written in C# from around the internet, and none of them would load the page.
我尝试从互联网上下载几个用C#编写的开源浏览器,但没有一个会加载页面。
EDIT 编辑
Here's all of my code - this application is super simple: 这是我的所有代码 - 这个应用程序非常简单:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace PureChat
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
webBrowser1.ScriptErrorsSuppressed = true;
webBrowser1.Navigate("https://www.purechat.com/w/cvadob");
}
}
}
Your immediate problem appears to be here in one of the linked JS scripts (CompiledWidget): 你的直接问题似乎出现在一个链接的JS脚本(CompiledWidget)中:
return f.trim();
Where the variable f is a string. 变量f是一个字符串。 IE has only supported string.trim() since version 9. Your WebBrowser control I suspect may be based on an earlier flavour of IE ?
从版本9开始,IE只支持string.trim()。我怀疑你的WebBrowser控件可能基于IE的早期版本? On my VS2010 setup I get your same error.
在我的VS2010设置上,我得到了同样的错误。 Haven't tried VS2013.
还没试过VS2013。
Normally the WebBrowser control runs in IE 7 compatibility mode. 通常,WebBrowser控件在IE 7兼容模式下运行。 You can modify this behavior using a registry key called Browser Emulation.
您可以使用名为Browser Emulation的注册表项来修改此行为。
Microsoft has a detailed list of all the possible keys: http://msdn.microsoft.com/en-us/library/ee330730%28VS.85%29.aspx#browser_emulation Microsoft提供了所有可能密钥的详细列表: http : //msdn.microsoft.com/en-us/library/ee330730%28VS.85%29.aspx#browser_emulation
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.