2

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.

necromos
  • 442
  • 2
  • 12
  • Not that I can answer your question, but I've been successfully using CKEditor 4 with WinForms' native `WebBrowser` control. It only took to implement [WebBrowser Feature Control](http://stackoverflow.com/a/18333982/1768303) to make CKEditor function properly. Did not need WebKit for this. – noseratio Jan 04 '14 at 12:32
  • Ok I will try this asap but question is, was it possible to take content written by user? I mean, was it possible to get this iframe? – necromos Jan 04 '14 at 14:29

1 Answers1

1

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);
noseratio
  • 59,932
  • 34
  • 208
  • 486
  • 1
    This works great, thank you very much. Still it leaves me with issue how to port it to .NET 3.5 unfortunately (if you have any idea how to do this I would be really grateful) but now I can move on at least a little bit with project. – necromos Jan 05 '14 at 11:52
  • 1
    @necromos, with .NET 3.5, you can use reflection instead of `dynamic`. Check this out: http://stackoverflow.com/a/19002650/1768303 – noseratio Jan 05 '14 at 12:02
  • You are magician in this. Works great and I couldn't imagine to find better answer. – necromos Jan 05 '14 at 15:43