Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6062941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:06:31+00:00 2026-05-23T09:06:31+00:00

I have been playing around with webkit.net in a c# win forms project, and

  • 0

I have been playing around with webkit.net in a c# win forms project, and love how easy it is to call JavaScript functions from within the C# program with:

browser.Document.InvokeScriptMethod("functionName", new object[]{"parameter1", "parameter2"});

Now the question is how to do this the other way round… Is there some sort of event listener that can listen for a javascript function call, or any way to invoke a c# method via the JavaScript running in the webkit browser?

The way I’m doing it at the moment it using a bad hack … having a look at the available event listeners, I hooked up to the TitleChanged event, and read the value of a hidden input field in the html …. this is really bad and needs an actual solution.

Thanks in advance,
– Greg.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T09:06:32+00:00Added an answer on May 23, 2026 at 9:06 am
        public Form1()
        {
            InitializeComponent();
            webKitBrowser1.Navigating += new WebBrowserNavigatingEventHandler(Form1_Navigating);
        }
    
    
        private void Form1_Navigating(object sender, WebBrowserNavigatingEventArgs e)
        {
            string url = e.Url.ToString();
            if (url.IndexOf("app://") > -1)
            {
                e.Cancel = true;
                processRequest(url);
            }
        }
    

    This may not pass your Ugly Hack test, but is an ancient method for processing requests from a .net embedded browser. Essentially you intercept a URL GET request in the browser. If the URL contains a keyword (such as app://), you cancel the GET and process the URL parameters. Returning a value, was traditionally accomplished by calling the Navigate Method, however, using the method you described in your post, you can just directly call a javascript function.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been playing around with creation of pdf documents for a project that
I have been playing around with node.js, and coming from a Java background, I
I have been playing around with ElasticSearch for a new project of mine. I
So i have been playing around with the .NET RIA Services with Silverlight, and
I have been playing around with some CSS3 + JavaScript today. Below you have
I have been playing around JavaScript for a year or so, one thing I
I have been playing around with Template functions, and made a little logger program.
I have been playing around with the postgresql.conf file for a couple days now.
I have been playing around with the EF to see what it can handle.
I have been playing around with the MS Source Server stuff in the MS

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.