2

I have an application that connects to www.Jango.com and using a web browser control. However when using the .NET browser control I constantly receive a script error of “Unable to get value of the property 'msIsSideMode': object is null or undefined”, and therefore the rest of the site does not load.

This can be reproduced by creating a simple windows forms application, adding a webbrowser control and navigating to jango.com

As far as I can tell, the web browser control renders a website based on the version of IE installed on your machine. On my machine I have IE9 installed. The method msIsSiteMode appears to be an IE method that tells weather the current page was launched as a pinned site. Since jango.com is very JavaScript based, this null value causes the website to stop functioning correctly. However navigating to jango.com in Internet Explorer works just fine and no errors are produced.

Is anyone aware of a way to work around this, such as having my application set the value? Have the web browser control render as a different version. Any suggestions at all, I am open to anything, except changing the version of IE on my machine as this is not an option.

Sam Plus Plus
  • 4,381
  • 2
  • 21
  • 43

2 Answers2

1

Set the ScriptErrorsSuppressed property to True on the WebBrowser control.

enter image description here

EDIT: One more alternative

Try this on the Form that hosts the web user control:

using System.Runtime.InteropServices;
using System.Security.Permissions;

[ComVisibleAttribute(true)]
[PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
        webBrowser1.ObjectForScripting = this;

    }
...
}

Read here for more detailed information.

Icarus
  • 63,293
  • 14
  • 100
  • 115
  • That will suppress the so it is not displayed, however the site will still not function because of this error. In other words, the error is still happening weather I suppress it or not. – Sam Plus Plus Aug 28 '11 at 07:23
  • @Sam Plus Plus: check my edit. I tested on my computer w/o suppressing the errors in the WebBrowserControl and I no longer receive the problem with the msIsSiteMode() call. Also check this: http://stackoverflow.com/questions/305915/winforms-how-do-i-execute-c-application-code-from-inside-webbrowser-control – Icarus Sep 02 '11 at 18:31
  • I ended up trying this as well, and I was able to work past the problem as well. However I ended up running to other issues, and ended up using a Gecko based web browser control instead. You are right though this answers my question. – Sam Plus Plus Sep 05 '11 at 04:35
0

I see similar problem in WebBrower Control with IE9 installed on my machine. In my case, I have two windows forms with WebBrowser Controls. One of those is used to load the pop up from the other.I get the script error on pop up one.its only with IE9

kumar
  • 1
  • 1
  • 1