Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to adjust each other between c # and js in WebKit.Net winform program

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article shows you how to tune c # and js in the WebKit.Net winform program, the content is concise and easy to understand, it will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

Lab 1:

Button 1 event:

CurrentPage.browser.DocumentText =

"Test Page" +

"Hello, World!

"+

"

A

B

C

"+

"" +

"function f () {window.open ('http://www.pudn.com/Download/item/id/2111740.html',' myWindow');}" +

"

Button 2 event:

CurrentPage.browser.StringByEvaluatingJavaScriptFromString ("f ()")

So when you click button 1 and then click button 2, you will jump to pudn. The experiment was successful.

Lab 2:

There is an index.html file under tomcat's webapps/ROOT:

TitleHello, World!

A

B

C

Hello world spring boot3function f () {window.open ('https://www.baidu.com',' myWindow');}

In the button event:

CurrentPage.browser.IsScriptingEnabled = true

CurrentPage.browser.StringByEvaluatingJavaScriptFromString ("f ()")

Can successfully jump to baidu. Browser_NewWindowRequest and browser_NewWindowCreated events can be executed, but browser_DocumentCompleted cannot be executed unless browse performs a refresh operation.

Https://bbs.csdn.net/topics/390962337/ and https://sourceforge.net/p/webkitdotnet/discussion/939856/thread/daaed049/ talk about 64-bit BUG, or multithreading, and all my experiments are abnormal.

Private void newWindowToolStripMenuItem_Click (object sender, EventArgs e) {if (MessageBox.Show ("This is likely to cause a crash. Continue? "," Warning ", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) = = DialogResult.Yes) {var thread = new Thread (new ThreadStart (MyThread)); thread.SetApartmentState (ApartmentState.STA); thread.Start ();}} private void MyThread () {Application.Run (new MainForm ()) }

It seems that setting ApartmentState.STA in this way does not work.

The above is how to adjust c # and js in the WebKit.Net winform program. Have you learned the knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report