Developing Chrome Core Browser "seven" based on. Net

Source: Internet
Author: User

This is a series of articles, the address of the previous six articles is as follows: developing Chrome core Browser "Six" based on. Net
Developing Chrome Core Browser "Five" based on. Net
Developing Chrome Core Browser "four" based on. Net
Developing Chrome Core Browser "three" based on. Net
Developing Chrome Core Browser "II" based on. Net
Developing Chrome Core Browser "one" based on. Net
This article is not very related to the previous six articles, if you do not bother to read the previous six, from the beginning of this article is no problem
The previous six articles, all based on the Xilium.cefglue Open source project, and later contacted Cefsharp (it is said that GitHub's client is also developed with this, but it feels a bit of egg pain) and then used Chromiumfx, Although the project is not cefshrp many people, but it is really comfortable to use the time, I will do the three items of horizontal comparison.
The above three items are all based on CEF, and honestly CEF This project with a strong racist colorAs early as 2011, the Chinese people mentioned that the Input Method prompt box can not follow the entry cursor problem,and given the solution, the request was merged into the trunk, but the person in charge of the project did not follow up this issue continuouslyNot until the last Monday to solve the problem, this period do not know how many Chinese, Japanese and Korean developers in this issue tangled I can only mercilessly say "I bought a watch last year!" "(Of course, this is a joke, I still respect the efforts and sweat of the open source community), the current Cefsharp, Cefglue, Chromiumfx have not been updated, the problem still exists in these three projects.
Also have to say nw.js, this is a domestic cattle people do open source projects, I have been concerned for a long time! Nodejs+chromium core and also share the V8 engine, the chromium package is very good, you can hardly find anything wrong to use Nw.js to develop a browser is not impossible, but must use Nodejs a bit of egg ache, I once gave the author Roger Wang sent an e-mail, begged him to do a go language or C # package, mail, such as Niniuruhai, no reply, but then said back to people, home is a cow, you can drop!
What we're going to say this time is based on the CHROMIUMFX open source project Browser application,Anyway
Environment DeploymentFirst of all, you download CHROMIUMFX class library, note that you want to write down his version number, such as the current version number is: 3.2171.13 second you want to download the CEF class Library, note that the version number here to download the previous version number is the same as the first two digits, Here is: 3.2171.2069
Create a WinForm project, run it, and create a CEF directory in the Debug directory: "BIN\DEBUG\CEF" then unzip the CEF package you downloaded and copy the contents of the release subdirectory toBIN\DEBUG\CEFand copy things from the resources sub-directory toBIN\DEBUG\CEF then unzip the CHROMIUMFX package and copy the file with the name beginning with LIBCFX to the bin\debug\cef directory this should probably be the case in the last directory:
Then let your project cite ChromiumWebBrowser.dll and ChromiumFX.dll,and have these two DLLs copied to the localYou cannot "enable the VisualStudio hosting process" When you set the "target platform" for the properties of your assembly "build" to x86 "debug"
starting and terminating the Chromium runtime First Look at the codeInitialize, the program will go to your execution path to find the CEF subdirectory, and load the relevant class library shutdown, the program will be recycledchromium Some of the resources that are occupied by the runtime; You can also set a specific path in this way
Cfxruntime.libcefdirpath = @ "C:\path\to\cef\directory"; Chromiumwebbrowser.initialize ();

use the browser control and display it on the formJust three lines of code, that's easy.
let the iframe in the Browse page execute the JS script look at the code first:
var f = wb. GetFrame ("Mem_index"); var js = file.readalltext ("Login.js", Encoding.UTF8); F.executejavascript (JS, "", 0);
Well, let's explain these lines of code.
The first line of code gets an IFRAME with the WebBrowser control there are several overloaded methods that I enter here is the name of the IFRAME, and Cfxframe getframe (long identifier); Note this is not an IFRAME ID. There is also a function very useful list<string> getframenames (); Get the names of all the IFRAME in the page
The second line of code doesn't have to be explained. You saw me write, login.js should know I wasn't doing anything good.
The third line of code is to let this iframe execute this JS script method signature is this: void Executejavascript (String code, string scripturl, int startLine); If your IFRAME is already loaded with jquery, then the code you execute is also the second and third parameters that can be used with Jqeury, which are related to error debugging.

Browser Load status change events
Wb. Onloadingstatechange + = Wb_onloadingstatechange;
void Wb_onloadingstatechange (object sender, Chromium.Event.CfxOnLoadingStateChangeEventArgs e) {if (E.isloadi ng = = false) {//do What Want}}
When loading is complete E. The value of isloading is False

PostScriptWrite here, and later in the eighth chapter of the series, the contents of the eighth will contain:
take over the JS dialog and automatically trigger the Yes or no button JS and C # communication registering a global callback function for a page or IFRAME request to take over or block a page

people like to ask for a recommendation, sharing knowledge is not easy, everyone come to thank me

Developing Chrome Core Browser "seven" based on. Net

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.