The Visual Studio WebView component uses the Microsoft Edge browser and is the upgraded version of the WebBrowser control that used older Internet Explorer technology, but the API is different.
Does anyone know the equivalent WebView control call for:
WebBrowser.DocumentText = "<html>Dynamic page content</html>";
I agree with the suggestion given by the #aepot that you can use the WebView.NavigateToString to load the dynamic HTML.
webView2.NavigateToString("<html> Test code </html>");
If it is a file then you can do like this:
webView2.NavigateToString(System.IO.File.ReadAllText(Application.StartupPath + "/11.html"));
OR
webView2.NavigateToLocal(#"\12.html");
Related
Is there an example of adding plugins to Google IE browser that supports language c# or .net I want to run files js - json - hrml popup
Microsoft just released Blazor, which allows browsers to run Razor / C# code on the client side. You could research and experiment with that.
However, you don't need that to run js - json - html popup. Use something like ASP.Net MVC to run any C# code on the server. The server generates your HTML and Javascript and stuff. Browsers know how to work with all of that stuff without any plugins.
This site will work better when you have specific questions and you can show your code and what you have tried. For a question like this, Google will work better for you! Good luck.
My objective is to render the html content into text with its styles, indent and all others. I just done a workaround with CEFSharp v1.25.5 with the following code and it works like charm.
CefSharp.Wpf.WebView webView= new CefSharp.Wpf.WebView();
webView.LoadHtml("<p> this is <b>paragraph<b></p>");
Since I am developing a 64bit application,I'm not able to implement the same in my application. So, I found latest version of CefSharp v37.0.0 with 64bit support. But the sad part is I could not find the 'WebView' here. I tried the following code without any luck.
CefSharp.Wpf.ChromimWebBrowser browser= new CefSharp.Wpf.ChromimWebBrowser();
browser.LoadHtml = ("<p> this is <b>paragraph<b></p>","dummy:");
I need to show the html webcontent in webview container in a 64bit target platform like the webview in Cefsharp v1.25.5.
Hi there's a few things you should do, all covered in CefSharp Troubleshooting.
Initialise CEF
Add the browser to the Controls collection
I prefer to LoadHtml in a method attached to the browser.IsInitialisedEvent (and only load when the event.IsBrowserInitialised is true)
Hope these help. If there are any other issue do let us know!
Currently I am working on my project which involves using webbrowser control in c#. After many struggles I successfully accomplished joining WebKit to WinForms application and run website with CKEditor in it but it gave me 2 issues.
1 Image uploader works fine but it doesn't send callback or WebKit cannot process it. Is there any possibility to make it work?
2 When I try to scrape html document to get the iframe by doing this: webKitBrowser1.Document.GetElementById("cke_1_contents").LastChild I get iframe element but I have no idea how to get content of it because it says that i doesn't have any childs.
Anyone can suggest me what to do next or give any alternative for this?
I use VS2008 and .NET 3.5.
I can't answer this question in the context of the WebKit-based control, but I suggest that you try the native WinForms WebBrowser control. It works great as the host for CKEditor, once the WebBrowser Feature Control has been implemented.
Then, if I was to do web-scraping on a page with CKEditor, I'd try something like this to get the current editor content (from C#):
dynamic pageDocument = webBrowser.Document.DomDocument;
var ckeDocument = pageDocument.getElementsByClassName("cke_wysiwyg_frame").item(0).contentDocument;
MessageBox.Show((string)ckeDocument.documentElement.outerHTML);
I've used Visual Studio Express to create a C# Form but I want to embed it in my website. I'm quite new to C# and Html and I would like to know how to embed a C# Form in Html. Just to let you know I am using Weebly and there is a custom Html element that i wish to place a C# Form in.
Internet Explorer can host .NET controls, but it is not recommended any more - this feature has been deprecated by Microsoft, replaced by Silverlight. I'm not sure what the current outlook is on the future of Silverlight.
I need to display HTML in my silverlight application and cannot find a way of doing it. I cannot use the web browser control as it needs to be able to run in or out of a browser.
Does anyone know of a good way to do this, because all I can think of doing at the moment is running replace methods on the text to just replace the tags with C# equivalents eg(<br /> to \n).
The way I do it is to check if the application is running inside the browser and change the means of display accordingly. If running inside the browser, I overlay the application with an IFrame, as I describe in this article: http://www.silverlightshow.net/items/Building-a-Silverlight-Line-Of-Business-Application-Part-6.aspx. Otherwise, I use the WebBrowser control. I have a control which does this all for you in the source code that accompanies my book, which is downloadable from the Apress website here: http://www.apress.com/book/downloadfile/4638.
Hope this helps...
Chris
I believe what you are looking for is HTML Bridge.
Edit I'm am actually now unsure if you'll still have access to javascript if you're running this OOB. I'm going to look into this some more and will further update. I'll still leave the answer up though for reference.
Second Edit Here is what I've found. HTML Bridge is disabled when you run silverlight out of browser. This disables access to the HTML DOM as well as Javascript. However, according to a comment on this site:
HTML Bridge is not available when you first install a OOB app. But you CAN force it if you modify the index.html in the folder where the app is installed just adding the enablehtmlaccess parameter.
It works!
You can even create dynamic HTML elements using the well-known methods of the HtmlPage class. You can even open a new browser window with the Navigate() method and its "_blank" parameter.
Keep in mind this information was posted about SL 3. Its possible that this may have changed, but I doubt it. So it seems that what you may want to do is build a script into the startup of your SL app that detects whether or not your app is running out of browser. If it is then you may want to have some script to call that can modify this file for you.
There recently was a similar question.
I posted a link there to an implementation that parses and displays HTML inline in Silverlight. Of course, it will work only with simple HTML, but maybe you can expand it to your needs.