Click here to Skip to main content
16,018,919 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Currently I'm working in a Wpf project where I have to load a custom payment gateway window inside a Wpf WebBrowser. When I submit the form inside the WebBrowser it should redirect to another UI. But, when I implement it and submit the form, there is nothing happening inside the WebBrowser. Actually the payment gateway is working with the browser but not working with the Wpf WebBrowser.

When I load the payment gateway window in the WebBrowser, a popup is appearing with the message saying

Script Error

Line: 3811
Char: 4
Error: Expected identifier
Code: 0
URL : http://localhost:49866/Scripts/jquery-3.1.0.js

I've checked that file and I couldn't find any issues.

when I select continue running scripts on this page and fill up the data and submit. Nothing happened.

I ran the WebBrowser in the Silent mode and continue. Now, no error popup, but still nothing happened.

What will be the reason for this? Did anyone came across this? What can I do now?

Please help me on this.

Thanks in advance.

What I have tried:

webBrowser.GetType().InvokeMember("Silent", BindingFlags.Instance | BindingFlags.Public | BindingFlags.PutDispProperty, null, webBrowser, new object[] { silent });
Posted
Updated 24-Mar-17 5:36am
v3

Unless you make changes to the registry for your specific application, the WebBrowser control is stuck in IE7 rendering mode:
Web Browser Control & Specifying the IE Version - Rick Strahl's Web Log[^]

Your site is using jQuery 3, which only supports IE9 or higher. If you want to support the WebBrowser control without changing the registry, you'll need to use jQuery 1.12[^] instead.

Alternatively, you could replace the WebBrowser control with CefSharp[^], an embedded version of Chrome, which doesn't suffer from these IE legacy issues.
 
Share this answer
 
I use the following code to hide any script errors:
C#
private void OnLoaded(object sender, RoutedEventArgs e)
{
    if (webBrowser!= null) webBrowser.HideScriptErrors(true);
}
Note: Don't forget to hook the Loaded event in the Host UserControl or Window.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900