سؤال

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. 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). I stopped the errors with:

webBrowser1.ScriptErrorsSuppressed = true; 

but I have not been able to get the JavaScript heavy page to load.

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.

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");
        }
    }
}
هل كانت مفيدة؟

المحلول

Normally the WebBrowser control runs in IE 7 compatibility mode. You can modify this behavior using a registry key called 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

نصائح أخرى

Your immediate problem appears to be here in one of the linked JS scripts (CompiledWidget):

return f.trim();

Where the variable f is a string. IE has only supported string.trim() since version 9. Your WebBrowser control I suspect may be based on an earlier flavour of IE ? On my VS2010 setup I get your same error. Haven't tried VS2013.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top