Two friends of mine have tested a project I have been working on which relies on the use of the WebBrowser control, and have managed to come across a constant scenario in which the WebBrowser control is unable to execute any JavaScript on the contained web page.
For the sake of narrowing it down I created a new Windows Forms project that contains only a WebBrowser control, and tries to navigate to the following page: http://javatester.org/javascript.html
The result on my friends computer was the below (click to enlarge):

As you can see, it doesn't render ANYTHING when trying to call the JS specific code, alternatively if you view it in a web browser with JS disabled or enabled, you'll see something.
He exported his registry keys that contain the setting for JavaScript being enabled (see https://gist.github.com/4699943) and the value for 1400 in each of the keys matches the same settings I use, and when I run the program I have no issue.
The code for the entire test project is as follows:
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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Shown(object sender, EventArgs e)
{
this.webBrowser1.Navigate("http://javatester.org/javascript.html");
}
}
}
If a new project is created using this code that targets the 4.5 framework (either on my machine or his) it works, however if one is created using 4.0 or lower the above result occurs. I'm not sure if this is a coincidence or if it is indeed something to do with the problem / solution.
It should be noted that if he navigates to this page in Internet Explorer there are no issues, it detects that JavaScript is enabled, this problem solely resides in this test application and the main project that it is a part of.
Any help would be appreciated, I've spent a good two months trying to figure this out and still can't.
It looks like the issue might be related to the version of the .NET Framework that you are using.
Are you able to try using a higher version of the .NET Framework and see if that resolves the issue?
If you are already using a higher version of the .NET Framework and the issue persists, you could try checking the following:
Make sure that the web page you are trying to load is not blocked by your firewall or internet security settings.
Check if the issue is specific to the WebBrowser control or if it occurs when you try to access the same web page in Internet Explorer.
Check if the issue occurs when you try to access other web pages using the WebBrowser control.
Check the Internet Options settings in Control Panel and make sure that the 'Enable JavaScript' option is checked.
If none of these suggestions help, it might be helpful to try and gather more information about the issue, such as any error messages that you are receiving and the version of Internet Explorer that is being used by the WebBrowser control. This information might help in identifying the root cause of the issue.