UPDATE: Source code available! See post here. Fixed keyboard / Javascript bug
Added some sample pixel shader effects! (including HatchingEffect by Charles Bissonnette). If you need Awesomium_d.dll (for debug builds) you can get it here.
Being able to render and interact with webpages within WPF opens up some great opportunities. While WPF already includes a WebBrowser, it’s just a wrapper around IE’s ActiveX control. Unfortunately this prevents it playing nicely with WPF’s layout system
Mixing Google’s Chromium project, a great wrapper called Awesomium and a little WPF pixie dust, we finally have one
:
You can try the ClickOnce application here. Source is available on CodePlex (discussed here). You should find it works great with Flash and Silverlight (assuming plug-ins already installed) but currently it might choke on XBAPs and Java applets.
If you prefer to run the binaries locally, you can get them here
For more examples, and an important note about VS2010, be sure to check out Sacha Barber’s related post.
For more fun, have a look at YouCube 3!


164 responses so far ↓
Will // August 25, 2009 at 1:04 pm |
Code, immediately.
Jeremiah Morrill // August 25, 2009 at 1:33 pm |
Very wicked!!!
Michael Brown // August 25, 2009 at 1:42 pm |
I like this a lot. Would love to get this on codeplex and help you build it up. This is awesome.
WPF Chromium WebBrowser source code! « Chris Cavanagh’s Blog // August 25, 2009 at 2:38 pm |
[...] Contact ← A Real WPF WebBrowser [...]
Roland Tomczak // August 25, 2009 at 3:54 pm |
Definitly, you’re the best
.. Hmm.. And.. Are you going to port Flash to WPF, too, so that we can go Youtube ?
Roland Tomczak // August 25, 2009 at 4:09 pm |
Arg.. And we can EVEN go Youtube (if the Flash plug in is installed in Chrome !)!
That’s insane !
WPF, Silverlight et autres… » Archive du blog » WebBrowser WPF // August 25, 2009 at 4:13 pm |
[...] d’info sur le site de Chris Cavanagh ou sur le codeplex de WPF [...]
Patrick Klug // August 25, 2009 at 4:58 pm |
Thank you guys for sharing this. This is awesome!
Chris Cavanagh // August 25, 2009 at 5:05 pm |
Roland – Yep, Silverlight works pretty well too
It chokes on XBAPs right now, but 2 out of 3 ain’t bad
A Real WPF WebBrowser « Chris Cavanagh's Blog · WPFdc // August 26, 2009 at 6:53 am |
[...] View original here: A Real WPF WebBrowser « Chris Cavanagh's Blog [...]
Dew Drop – August 26, 2009 | Alvin Ashcraft's Morning Dew // August 26, 2009 at 6:59 am |
[...] Cursor from HCURSOR and A Real WPF WebBrowser and WPF Chromium WebBrowser source code! (Chris [...]
Jack // August 26, 2009 at 5:55 pm |
Very nice. Had wondered about a WPF browser myself.
Performance seems decent. Any thoughts on that?
Is is possible WPF could be better than GDI (or whatever firefox/chrome use natively) for browser rendering?
Jeremiah Morrill // August 26, 2009 at 6:28 pm |
I think the D3DImage might yield even better performance vs. the WB. If I had time, I’d like to give it a go!
Chris Cavanagh // August 26, 2009 at 6:44 pm |
Jack / Jerimiah – I’ve been impressed with the WriteableBitmap performance. I toyed with using RTB but gave up pretty quickly (sorry J! My first attempt failed so I wussed out)… maybe WPF will eventually get Silverlight’s Raw AV
Reflective Perspective - Chris Alcock » The Morning Brew #421 // August 27, 2009 at 1:35 am |
[...] A Real WPF WebBrowser – Chris Cavanagh has been at work combining the Chromium and Awesomium projects with some WPF to create a fully functional WPF based web browser allowing you to have a web browser component in WPF applications which behaves well in the WPF layout system. Source is available on CodePlex, and there is a ClickOnce demo too. [...]
Jason // August 27, 2009 at 6:44 am |
Is there any way to access and manipulate the DOM?
Chris Cavanagh // August 27, 2009 at 8:58 am |
Jason – Yes there is, but I’ve not looked in much detail at it yet. Awesomium has a mechanism for passing objects to the browser and calling Javascript methods. I’ve not exposed those on my wrapper yet, but probably will do soon
Jason // August 27, 2009 at 9:22 am |
Chris, excellent work, looking forward to any updates…
Paul Betts // August 27, 2009 at 11:31 am |
So this doesn’t have the Airspace issues that the IE WebBrowser control has? That’s awesome!
Chris Cavanagh // August 27, 2009 at 12:11 pm |
Paul – Right; it’s using a couple unmanaged DLLs, but they render directly to memory (and eventually a WriteableBitmap). Be sure to try it with Flash & Silverlight content too…
ivoryguard // August 27, 2009 at 4:09 pm |
It’s great work!
It is very fast and works with Flash and Silverlight.
However, some Silverlight apps using WebClient(by HTTP Post or Get) at Application_Initialize procedure may not work well.
Downloading Xap file succeeds but it may not work fully.
Chris Cavanagh // August 27, 2009 at 9:41 pm |
ivoryguard – I’ve noticed the same thing about WebClient (http://www.chriscavanagh.com/chris/SilverGlulxe/SilverGlulxeTestPage.aspx)… I’d assume SL3 apps that use the native networking stack instead would be ok. There’s a new release of Awesomium due soon; maybe it’ll improve things
kulveer // August 29, 2009 at 2:50 pm |
Good collection
see this blogs. I liked this blog, it has lots of
nice articles
http://aspnetcsharp4.blogspot.com/
tung // August 31, 2009 at 4:15 am |
There is error:
Cannot create instance of ‘WebBrowser’ defined in assembly ‘Cjc.ChromiumBrowser, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’. Exception has been thrown by the target of an invocation. Error at object ‘grid’ in markup file ‘Cjc.ThreeDeemium;component/window1.xaml’ Line 19 Position 10.
can you help me?
Chris Cavanagh // August 31, 2009 at 7:45 am |
tung – Are you hitting a breakpoint, or is this happening with the ClickOnce demo? It’d be great if you could get me the InnerException…. Thanks!
tung // August 31, 2009 at 7:51 pm |
Hi Chris Cavanagh
i’m download your program from
http://wpfchromium.codeplex.com/
This is InnerException
Visual Studio Debugger
Troubleshooting Exceptions: System.Reflection.TargetInvocationException
The exception that is thrown by methods invoked through reflection.
thanks.
Chris Cavanagh // August 31, 2009 at 8:31 pm |
tung – Could you send me a screenshot of the Exception helper? Make sure the native DLLs are present in the current folder at runtime (debug or release) – they won’t automatically be pulled in like regular assemblies.
BobTLO // August 31, 2009 at 8:54 pm |
I also downloaded the source code on Aug. 31, and I found that there was a missing file in the browser project (Awesomium_d.dll). That is the debug version for Awesomium. If you change to the Release version on the .NET solution/projects, everything runs.
Chris Cavanagh // August 31, 2009 at 9:39 pm |
BobTLO – Good point. Awesomium_d.dll is around 50MB so it wasn’t practical to put that on Codeplex. You could build it yourself if you have all the Awesomium and Chromium source. Alternatively you could just dig around online until you find the latest pre-built DLLs:
1) Download 3rd.zip.001 – 003 here: http://forum.quest3d.com/index.php?topic=67161.45
2) Merge them into one zip:
copy /b 3rd.zip.001 + 3rd.zip.002 + 3rd.zip.003 3rd.zip
3) That should have everything you need
(sorry it’s a hack; hopefully the situation will improve soon).
tung // September 2, 2009 at 7:39 pm |
Hi Chris Cavanagh
I’m download and paste it in Debug and it run.
Thanks for help me.
First i think Awesomium_d.dll file not important so i was delete it.
BobTLO – Thanks your imformation
j3nonk // September 3, 2009 at 10:34 am |
Hi Chris,
I’m about to try this component. I think it’s interesting and I think you have done a great job to find other solution beside using the webbrowser control. It’s pretty annoying, blocking the view of other wpf controls such as drop down menu, etc.
I just download the source code (wpfchromium-27825.zip). and i saw that beside the awesomium_d.dll is missing. there are others that missing too: app.config and DeleteMe.cs. can i delete those missing files from the project or we need them too just like the awesomium_d.dll?
btw, will this component work under xbap partial trust?
thanks.
Chris Cavanagh // September 3, 2009 at 10:47 am |
j3nonk – Thanks for pointing those files out. I’ve removed DeleteMe.cs and added app.config to SVN. You’ll need to get Awesomium_d.dll elsewhere (see below); you only need that to run a debug build:
1) Download 3rd.zip.001 – 003 here: http://forum.quest3d.com/index.php?topic=67161.45
2) Merge them into one zip:
copy /b 3rd.zip.001 + 3rd.zip.002 + 3rd.zip.003 3rd.zip
It’s likely it’ll need full trust because it’s running native code. If deploying a certificate is an option, this might help: http://blogs.microsoft.co.il/blogs/maxim/archive/2008/03/05/wpf-xbap-as-full-trust-application.aspx
Hope this helps!
j3nonk // September 3, 2009 at 11:09 am |
Hi Chris,
It work. thanks for your support.
But, there is a problem in the design view.
When i open Window1.xaml, the design view can’t be displayed. Problem loading, the error is: Could not create an instance of type ‘WebBrowser’.
Am i missing something?
Thanks.
Chris Cavanagh // September 3, 2009 at 11:21 am |
j3nonk – It’s probably the missing Awesomium_d.dll; you should place it somewhere Visual Studio can find it…
Meanwhile I’ll look into making the WebBrowser control behave better on a design surface.
tung // September 3, 2009 at 8:21 pm |
hi Chris Cavanagh
i built your program in VSS2008 and run it ok
but when i bring it to other computer and turn on it can’t run, when i run it,the program close automatic.
but when i setup VSS2008 in that computer and run program again, it ok.
i don’t understand. you can help me.
thanks.
Chris Cavanagh // September 3, 2009 at 9:35 pm |
tung – Can you confirm all the required DLLs are in the working directory, and that the machine has .NET 3.5 SP1 installed?
Try opening the ClickOnce app on this page. It should install any prerequisites. You can easily create a ClickOnce install for your own project too (remember to make sure the Awesomium.dll and icudt38.dll files are included in the deployment).
tung // September 4, 2009 at 7:51 pm |
hi Chris Cavanagh , my programe was built on .NET 3.5 SP1, use WPF. webbrower is a one of screen of programe.
when i click to open web form it turn of that form.
(include Awesomium.dll, Awesomium_d.dll and icudt38.dll )
but i install VSS2008 it run normal. i try to many computer and result the same.
tung // September 4, 2009 at 8:39 pm |
and this is error :
EventType : clr20r3 P1 : web.exe P2 : 1.0.0.0 P3 : 4aa1c9ec
P4 : presentationframework P5 : 3.0.0.0 P6 : 488f142e P7 : 6259
P8 : e1 P9 : system.windows.markup.xamlparse
tung // September 4, 2009 at 8:51 pm |
and your program http://www.chriscavanagh.com/chris/Cjc.ThreeDeemium/Cjc.ChromiumBrowserDemo.zip, it ok
Chris Cavanagh // September 4, 2009 at 8:53 pm |
tung – The zip is probably outdated a bit… sounds like I introduced a new bug
Also your error log says xamlparse; I’ll go have a closer look at the xaml…
Chris Cavanagh // September 4, 2009 at 9:14 pm |
tung – Are you on an x64 OS, and does the app crash as soon as you run it? If you set “break on all exceptions” in VS, does it catch anything while running or closing the app?
Chris Cavanagh // September 4, 2009 at 9:25 pm |
tung – Sorry, I misread your comment. Can you send me your VS project? (or exe I can run). Try attaching to the DispatcherUnhandledException event (in your App class) and see if that catches anything.
It could be there’s an exception being thrown on another thread and not caught… By default that would shut down your app; instead you can catch it and then pass the error to the main/UI thread.
Also make sure if you’re responding to any events raised by the WebBrowser control, use the Dispatcher if you indend to update the UI (I’ll probably change my WebBrowser control to do this itself).
tung // September 4, 2009 at 10:09 pm |
Chris Cavanagh – my os 32bit,
does the app crash as soon as you run it- yes
when i try catch:
try
{
InitializeComponent();
}
catch (Exception e)
{
MessageBox.Show(e.Message.ToString());
}
in xaml:
there a message :
Cannot create instance of ‘WebBrowser’ defined in assembly ‘Cjc.ChromiumBrowser, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’. Exception has been thrown by the target of an invocation. Error at object ‘grid’ in markup file ‘Cjc.ThreeDeemium;component/window1.xaml’
but i include (Awesomium.dll, Awesomium_d.dll and icudt38.dll ) in project and debug
and final: when i install VSS2008 for debug it run ok. other computer no install vss2008 only .net 3.5sp1 error appear
tung // September 4, 2009 at 10:10 pm |
sorry in xaml file :
tung // September 4, 2009 at 10:10 pm |
Chris Cavanagh // September 4, 2009 at 11:22 pm |
tung – You can mail me at tung @ chriscavanagh.com
tung // September 5, 2009 at 12:51 am |
The program is too big i can’t attach mail so i upload to mediafire : http://www.mediafire.com/?sharekey=fb84d2074b92949b6e7203eb87368129e04e75f6e8ebb871
thanks
Friday Links #66 | Blue Onion Software * // September 5, 2009 at 6:49 am |
[...] Web.Config Files (VS 2010 and .NET 4.0 Series) – ScottGu's Blog Fun With Method Missing and C# 4 A Real WPF WebBrowser « Chris Cavanagh’s Blog Silverlight Spy 3 updated : First Floor Software Fluent NHibernate 1.0 Released – Convention over [...]
Scott_T // September 6, 2009 at 2:44 am |
I ran into problems that seem to be similar to what tung is facing. I had to download the awesomium_d.dll, and ensure it was put in the right place, then I ran into the cannot create an instance of WebBrowser issue.
I traced the problem back to the source code and found that it had to do (at least in my case) with a line of code in the file Cjc.ChromiumBrowser.WebBrowser.cs.
There is a line where ‘bitmap’ is set equal to a new WriteableBitmap with (width, height, 96, 96, pixelFormat, null) being passed into the constructor. I found that when height and width were zero an error was thrown and the program crashed.
To remedy this all one has to do is set the height and width in the xaml file, something I had not been doing previously.
This seems like a quick and dirty solution, as there should be a way to make it fill the grid/tab/whatever control element it is placed in. I’m pretty new to xaml so that is the only solution I’ve come up with so far.
Chris Cavanagh // September 6, 2009 at 7:18 am |
Scott_T – Thanks for the feedback! Looks like I forgot to check some changes in
Here’s the update: http://wpfchromium.codeplex.com/SourceControl/changeset/view/28389#413984.
Let me know if any other problems
Davide // September 7, 2009 at 8:55 am |
Hi Chris, i’m writing a wpf application to display several media contents at time and i tried your work.
However i get 2 errors using multiple browser instances + flash on the same form.
1) webView.LoadURL(); / .LoadHtml(): I wrap an swf into htm… using the first and opening the html file it works, else it creates only the first swf instance.
2) Opening the same swf file 2 times application crashes without any error hint.
Any idea about this?
thanks
Chris Cavanagh // September 7, 2009 at 12:01 pm |
Davide – I’ve noticed a couple of odd things in another demo (http://chriscavanagh.wordpress.com/2009/08/27/wpf-3d-chromium-browser/); it seems if more than one page has Flash content, it’ll stop updating unless the mouse is directly over it (not something I’m doing). It doesn’t crash though; which urls are you testing with?
Davide // September 8, 2009 at 3:08 am |
Il seems not to be a mouse fault. Pages always perform rendering. I tried several links, you can try http://www.macloo.com/examples/flash/animation/index.htm
You can get a built test form for my app at http://www.prenassi.it/sysdata/MSC_Release.rar (just put a link and click “Crea timeline” twice)
WPF WebBrowser - Awesome!! | Codedstyle // September 8, 2009 at 11:06 am |
[...] and a WPF. The source code is also available – so makes for some nice reading Original link Share this post [...]
wayne // September 8, 2009 at 4:00 pm |
Hi Chris,
Is there any way to use a html string as input to the control – like WebBrowser.NavigateToString ?
Cheers,
Wayne
Chris Cavanagh // September 8, 2009 at 6:23 pm |
wayne – If you look at the underlying Cjc.AwesomiumWrapper, you can call LoadFile, LoadURL or LoadHTML. I only exposed the LoadURL so far (as Navigate) but it’d be easy to extend… (I’ll probably modify the WebBrowser control, but you could grab the source and add it if you prefer).
Chris Cavanagh // September 8, 2009 at 7:47 pm |
Davide – I tried your app and had around 4 browsers running before it died… Can you get a call stack and paste it here?
If it’s in the Managed C++ (or worse, native C++) I’ll probably go get the Awesomium & Chromium source and take a closer look (I was lazy and used prebuilt binaries so far).
tung // September 8, 2009 at 8:41 pm |
hi Chris Cavanagh : i’m find cause, but i don’t know why.
When i copy your dll Cjc.AwesomiumWrapper.dll to my project and bring it to other computer int run ok.
i compare two dll your size is 122368, and my size 138752, can you suguest anything?
Chris Cavanagh // September 9, 2009 at 12:08 am |
tung – Could you email me both DLLs? If you add an assembly reference to Cjc.AwesomiumWrapper.dll to your project (instead of the project reference) does it all behave correctly?
Are you compiling a release or debug build?
I looked at the project you sent; currently Cjc.AwesomiumWrapper isn’t set to build (in Configuration Manager)… Is this deliberate?
Aron Yu // September 9, 2009 at 12:48 am |
Ooooh my F god!!!! This is smokin’ hot!!!
Davide // September 9, 2009 at 1:50 am |
Sorry Chris. No call stack… VS 2008 is unable to catch the failure. vshost is killed by system and application quits. No way to debug and disassembly doesn’t help.
I’ll let you know…
Chris Cavanagh // September 9, 2009 at 7:33 am |
Davide – Check your Application event log (can’t remember if WPF logs unhandled exceptions by default or not). Failing that, try attaching an unhandled exception handler to the AppDomain (http://msdn.microsoft.com/en-us/library/system.appdomain.unhandledexception.aspx)… You might not be able to prevent the app exiting, but maybe can get an EventLog.Write or something in there…
Davide // September 10, 2009 at 1:31 am |
Myapp has already an UnhandledException Handler but it doesn’t catch anything. System Event log only says “appcrash” no more details. The solution finder on vista suggest me there’s a flash plugin problem.
Maybe i can wait until the awesomium.dll 1.5
tung // September 11, 2009 at 7:41 pm |
Hi Chris Cavanagh , this is dll my project
i add your dll to assembly reference but not success.
http://www.mediafire.com/download.php?qmtymd5dfyj
Conor Woods // September 14, 2009 at 5:43 am |
Hi Chris,
Great example and am having fun with the code at the minute.
However, I am having a problem with shortcut keys i.e. the control does not seem to recognise ctrl+(+) to zoom in on the content.
It would be really cool if the control supported this Chrome feature.
Can this be done by tweaking your example, or does it go deeper into the awesonium library?
Conor.
Chris Cavanagh // September 14, 2009 at 8:02 am |
Conor – Awesomium exposes a few methods like Zoom, Copy, Paste etc. Curretly they’re not visible through my wrapper, but obviously they’d be easy to add. You’d just need to attach your own KeyDown/KeyUp handlers to call them
Conor Woods // September 16, 2009 at 3:03 am |
Cheers Chris, sounds like a plan.
Keep up the good work.
Tai Lee // September 22, 2009 at 10:37 am |
Greate application, but it could not run Deep zoom site, normal silverlight sites are OK, do you know why?
Chris Cavanagh // September 22, 2009 at 1:59 pm |
Tai – It seems Silverlight apps that use WebClient have some issues. I’m assuming it’s related to SL2 always using the browser’s HTTP stack (apps using SL3’s own networking might fare better: http://blogs.msdn.com/silverlight_sdk/archive/2009/08/12/new-networking-stack-in-silverlight-3.aspx). I’ll kick it around and update here if I find anything
Gianni RG // September 23, 2009 at 7:11 am |
Hi!
Great job, Chris!
I was starting to write a WPF Chromium wrapper for my MS thesis, when I found your project and Awesomium: thank you!!
I’m trying to embed the WebControl in a WPF touchscreen interface. In order to let the user easily scroll a web page, it would be better to use a re-styled scroll-bar instead of the standard one.
Is there a way to do that with WPF styling on your control? I already tried to override the standard styles, and also to disable the scrollbars, but it doesn’t work… Are the scrollbars generated by Awesomium?
Chris Cavanagh // September 23, 2009 at 8:37 am |
Gianni RG – Awesomium (or perhaps Chromium itself) generates the scrollbars, so right now we’re pretty restricted. At some point I’ll probably build Chromium from source (everything so far was from prebuilt Awesomium binaries) and see what level of control it offers. I’d assume it’s plenty, but I’ve not looked at any of their source yet…
Gianni RG // September 23, 2009 at 9:00 am |
Thank you for the reply!
I had supposed so…
I’m a bit in a hurry with deadlines for my MS thesis, so I have no time to look at Chromium sources these days.
Anyway I think I will continue the WPF Touch Interface project after graduation, in order to include a full-touchable browser. If I discover something, I’ll let you know…
Chris Cavanagh // September 23, 2009 at 8:51 am |
Gianni RG – Another option (actually a dirty hack) would be to hand Awesomium an oversize bitmap that could fit “any” page height… As long as AllowAsyncRendering=false, calling WebView’s Render method should return you the area that was updated… Potentially you could initialize a Rect to 0,0 at the start of navigation, then stretch it to fit each successive render… Very very nasty hack, but it may be adequate in the (very) short-term…
Davide // September 28, 2009 at 4:49 am |
Hi Chris,
I get the latest version of your code and now seems it works fine with multiple flash pages.
However there’s a weird thing… using moving animations it seems that mouse events are not handled properly.
You can get a demo on http://www.prenassi.it/sysdata/PlayerMSP.v1.rar there’s an example file to load and run. Often after animations browser loose interactive capabilities, if you try rightclick context menu appears in anomalous position.
P.S. I needed to put some “if(webView != null)” on AttachEventHandlers() delegates in WebBrowser.cs
Chris Cavanagh // September 28, 2009 at 10:22 am |
Davide – Thanks for the update. I wasn’t able to get your exe to browse anything (I loaded the included XML file, but it didn’t appear to do anything). I’ll apply the fixes you suggested for the ( webView != null ) checks.
Fyi the browser right-click isn’t really supported (yet). AwesomiumWrapper just sends the mouse events to the browser; currently Chromium is displaying its own window so it’d be tricky to align that with the WPF content. We’d need to take a closer look at Chromium & Awesomium to figure out the best way to handle it.
Davide // September 28, 2009 at 10:44 am |
Well, it’s in italian, you have to first open xml file then from menu >Azioni > Riproduci and it’will start
Chris Cavanagh // September 28, 2009 at 10:58 am |
Davide – Ah I tried that, but it popped up a dialog showing a NullReferenceException
…:
Eccezione non gestita System.NullReferenceException: Object reference not set to an instance of an object.
at MediaSpreaderClient.Parser.XmlPalimpsestParser.ReadPalimpsestAttributes(XmlNode palimpsestNode, IPalimpsestWorkspace workspace, OperationQueue queue)
I’ve mailed a screenshot…
BenCause // October 5, 2009 at 8:23 am |
Hi,
Great job Chris! I am looking to get rid of the old browser component for months!!
One question though. Which .net framework your control depend on? 3.5?
My app is 3.0 SP1 and I would like to keep it this way if possible… Will your control work on 3.0?
Thanks
Chris Cavanagh // October 5, 2009 at 9:11 am |
BenCause – The demo is built against 3.5SP1, but there’s a fair chance it’ll work with 3.0 too. First try using the Cjc.ChromiumBrowser in your 3.0 project and see if it likes it. If not, you might need to recompile Cjc.ChromiumBrowser (which might need some tweaks for 3.0, like removing LINQ statements or anonymous delegates). Cjc.AwesomiumWrapper should work without changes/compiling, but let me know if that’s not the case.
If you’re able to upgrade to 3.5, you’ll probably benefit from the WPF performance improvements that were made. How much are you tied to 3.0?
Hope this helps!
BenCause // October 5, 2009 at 1:01 pm |
Thanks Chris! I will try that and get back to you.
About 3.0, it is more a commercial issue than a technical one. I am trying to minimize the size of the overall download and installation time for my users… If I could get rid of all dependencies to the framework I would but unfortunately Microsoft did not provide any linker.
If you have any ideas on how to optimize my deployment I would be glad to hear
!
Thanks
tung // October 7, 2009 at 2:45 am |
hi Chris Cavanagh , when i install Vietnamese Keyboard for Windows at http://www.unikey.org/ and type vietnammese in webbrower it not correct.
mohoch // October 11, 2009 at 6:34 am |
hi Chris.
I am trying to use your control in my app and getting the “Cannot create instance of ‘WebBrowser’ ” exception. I am running the application in release mode, so it shouldn’t be connected to the missing dll. when I run your demo – it works fine. when I use the dll for my app – it doesn’t initialize.
I checked and saw the crash happens in the static constructor, when the webCore is populated.
I guess I am missing something that you did, some property that must be initialized or something. can you help me to figure out what I am missing?
Thanks a lot
mohoch // October 11, 2009 at 7:21 am |
I found the inner exception saying “The specified module could not be found. (Exception from HRESULT: 0×8007007E)”. this is strange since I am running in release mode
Chris Cavanagh // October 11, 2009 at 7:38 am |
mohoch – Make sure Awesomium.dll and icudt38.dll are in the same folder as your other binaries. They’re both native DLLs so won’t be searched for like .NET assemblies. Are you using the GAC?
Is there any chance you have dependencies of your own that might be missing? The Assembly Binding Log Viewer (http://msdn.microsoft.com/en-us/library/e74a18c4(VS.71,loband).aspx) might help find any other assembly issues…
Hope this helps!
mohoch // October 11, 2009 at 9:11 am |
Thanks Chris.
I had to move all dlls to the release directory of my application and now it works.
For the benefit of other developers I want to add that it is important to set the Source property of the browser before using it, or else you will get the “You need to pass a non-null String” exception.
Thanks again. this works great!
Chris Cavanagh // October 11, 2009 at 9:58 am |
mohoch – Thanks for the comment; I’ll go fix that bug
mohoch // October 12, 2009 at 7:41 am |
Wow! thanks for the quick fix!
Chris, 2 more questions:
1. I tried playing YouTube videos in the RealBrowser and that worked fine. But when I try to display only the video player and not the full YouTube page, it doesn’t work – the window stays blank. I tried the URLs in regular Chrome browser and it worked fine so i am not missing any plugins. what do you think?
2. I did what you recommended in this thread and added the methods for LoadHTML and LoadFile, and that also works OK. But my app has to display UTF-8 characters, for different languages, and I saw that when I use these 2 methods the browser doesn’t respect that (with LoadURL it works fine). is there a possiblilty that the LoadHTML doesn’t support UTF-8?
Chris Cavanagh // October 12, 2009 at 9:36 am |
mohoch:
Thanks!
1) I’ll look into it…
2) I’ve made some changes that *should* handle UTF8 ok, but haven’t tested it yet. If you try it (latest source on Codeplex) it’d be great if you could let me know if it works or not
mohoch // October 12, 2009 at 9:50 am |
Thanks Ill check it out.
I added these 2 methods in the WebBrowser class, just under the Navigate method
///
/// Displays a string as HTML in the browser
///
/// the HTML
public void LoadHtml(string html)
{
if (webView != null) webView.LoadHTML(html);
}
///
/// Reads an HTML file located on the local macine
///
/// the physical path of th file
public void LoadFile(string path)
{
if (webView != null) webView.LoadFile(path);
}
Chris Cavanagh // October 12, 2009 at 10:32 pm |
mohoch – I tested the UTF8 changes and they appear ok
Also added your LoadHtml & LoadFile methods.
mohoch // October 13, 2009 at 1:30 am |
Chris the latest version doesn’t compile. there is file missing – clix.h
Chris Cavanagh // October 13, 2009 at 5:57 am |
mohoch – Sorry! File now added
mohoch // October 13, 2009 at 9:37 am |
Hi Chris.
Thanks for the fixes.
We are using the latest version and something weird happened – the links are not working any more. I will try to use the clix.h file with an older version and I will report to you tomorrow.
Chris Cavanagh // October 13, 2009 at 9:46 am |
mohoch – Very odd… Here’s a few questions:
1) Is that in your own app or the WebBrowser demo I posted?
2) Do mouse events otherwise work as expected? (hovering over links highlights them etc)
3) If you tab through the links and hit enter, does it navigate?
4) Does this happen for every site?
Meanwhile I’ll check for anything I might’ve broken.
mohoch // October 13, 2009 at 9:55 am |
1. its in my app
2. not all events are working as expected. on hover the cursor not always getting the right style.
3. the Tab and Enter thing works sometimes, mainly for inputs and not for anchors
4. the one I tried all had the same problem
Chris Cavanagh // October 13, 2009 at 10:02 am |
mohoch – Can you get the same thing to happen in the demo? (http://www.chriscavanagh.com/chris/Cjc.ThreeDeemium/publish.htm). Do you have any event handlers attached? (BeginNavigation etc). It could be I’ve “broken” some of the events… check you’re getting valid strings passed to handlers.
Do you have a sample project showing the problem that you could send me? (mohoch at chriscavanagh.com)
mohoch // October 13, 2009 at 3:50 pm |
Hi.
Sent you the sample app.
I am using the “FinishLoading” event, but experiencing no problems.
tung // October 13, 2009 at 8:49 pm |
hi Chris Cavanagh.
when i run your program(the last source) and open google page and type asia laguage ex: vietnamese, japanese, china and korean it not appear.
this is my image i capture
http://www.mediafire.com/imageview.php?quickkey=mn1dty54zje&thumb=4
you can see to help me, respectfully
Chris Cavanagh // October 13, 2009 at 9:37 pm |
tung – I’ll take a closer look and update here…
mohoch // October 14, 2009 at 8:07 am |
Hi Chris.
1. The link problem was solved when I removed the event handler for the “ReceiveTitle” event. maybe the event is broken as you said.
2. Does the browser support “target:_blank”? it doesn’t seem to work on my side. maybe there is a way to add it.
3. is there a way to cancel navigation after it starts?
4. I am trying now to add scrollbars on the container of the browser. the problem is that the browser always gets the size of the container itself. is there a way of making its width and height be the full width and height of the content?
Chris Cavanagh // October 14, 2009 at 9:27 am |
mohoch:
1) I’ll take a closer look at the code…
2) It doesn’t support opening new windows; it’s likely Awesomium doesn’t expose that (yet; version 1.5 is due “soon”)
3) Not yet, but maybe with Awesomium 1.5…
4) Again, Awesomium is handling this. I can think of a few hacks that might work (rendering to oversize image and using a ScrollViewer)… the difficulty is finding the rendered page size. Similar answer to (2) and (3) – Awesomium doesn’t currently expose it…
It’s looking like Awesomium 1.5 will be released Real Soon Now…
tung // October 15, 2009 at 10:30 pm |
hi , i find a bug
when i input http://kr.yahoo.com/ and press some link the programe is interupt .
this is a image: http://www.mediafire.com/imageview.php?quickkey=zygzmdzn3mf&thumb=4
Chris Cavanagh // October 16, 2009 at 8:36 am |
tung – Thanks! I tried it a few times with that url but couldn’t get it to crash
Could you try it again (in Visual Studio; debug build) and see if you can get a stack trace? It’ll help me narrow down where the exception’s thrown. Thanks again!
tung // October 16, 2009 at 8:17 pm |
hi Chris Cavanagh, thanks your postback
i try to debug in VSS but when i input http://kr.news.yahoo.com/ then program interupt i can’t do anything, i think that is a memory error when it loading advertising banner
this is a images
http://www.mediafire.com/imageview.php?quickkey=nkk2nzz2tii&thumb=4
http://www.mediafire.com/imageview.php?quickkey=hmmjmm0ikq5&thumb=4
i make a rectangle
Chris Cavanagh // October 16, 2009 at 9:33 pm |
tung – I’ll take a look at the code (will probably force some exceptions & improve handling). Does this happen with any size window, or only when it’s maximized or the scale slider is moved?
Could you try the same page inside NaviDemo? (http://princeofcode.com/blog/?tag=navidemo). It’s using Awesomium too, but it’s a native C++ app — it might help us localize the problem.
tung // October 19, 2009 at 2:59 am |
i’m writing a program in WPF
my program has a window webbrower and i use web control of VSS, it ok but my programme has a function rotate screen so webbrower also tranfrom
but it not support in VSS, so i search in google and find your programme , that bring me much attention.
but currently there are some errors that I do not know how handle. that is keyboard input and some site interrupt programme with any size windows.
you can give me any advice?
respectfully
Radu // October 20, 2009 at 6:41 am |
Everything goes well…there is still one annoying thing..tooltips within the browser are always shown with the same orientation, regardless how the browser is rotated
Chris Cavanagh // October 20, 2009 at 8:33 am |
Radu – Actually that’d be pretty easy to change if you wanted (and didn’t mind tweaking WebBrowser.cs a bit). It uses WPF’s regular Tooltip, but it’d be straightforward to change it to your own element (as a child of the WebBrowser it’d rotate/transform with it). Let me know if you need any help navigating the source code…
Microsoft RealDolmen blogs | Links & Pieces – September 2009 // October 28, 2009 at 6:29 am |
[...] A Real WPF WebBrowser [...]
Laurent // October 30, 2009 at 10:38 am |
Hi,
You made an awesome work !!! Thank you very much for it !!! We can now have fun with the browser in WPF. This is priceless.
Unfortunately, I found a strange behavior with the DragonFly Autodesk’s website : http://dragonfly.labs.autodesk.com/#index=home
The site works well on Chrome, but when I test it with Cjc.ThreeDeemium, it stops at 100%.
Do you have any idea why it hangs on chromium and not on chrome ?
Thanks again for your work !!!
Roman // November 1, 2009 at 10:54 am |
Hi
Thank you for your work!
How I can get current snapshot of WebBroswer control? Is it possible to catch it at 10-25 fps speed?
I want to capture it to video file… Have really good DirectShow experiense, now want to get frames from browser. With Flash that’s not possible with standard IE control.
Thank you!!!
Chris Cavanagh // November 1, 2009 at 2:29 pm |
Laurent – If you open the WPF browser as an app (from Start menu instead of ClickOnce from page) do you still get the same problem? (works for me from Start menu, but not browser)…
Chris Cavanagh // November 1, 2009 at 2:49 pm |
Roman – If you use the Cjc.AwesomiumWrapper assembly directly, you can ask it to render as often as you like. Let me know if you need more detail on how to use it.
Roman // November 2, 2009 at 1:43 am |
Hi Chris
No, I want to use WebBrowser control, so, user must use it as real browser, click on links or Flash control buttons and so on.
So, I want to use WebBrowser and capture snapshots from it.
I checked console sample, but it’s doesn’t show how to do that with WebBrowser control.
Flatval // November 2, 2009 at 7:14 am |
Hey! Great work on gathering quite a few loose ends to get some real browser power into WPF. I have finally overcome some starter problems and I have one tiny question:
My test application will connect to a local server over HTTPS, this means I have a self-signed certificate that won’t automaticly be accepted by the browser. Connecting to a server with a real certificate loads the page just fine, but I get a white page on my localhost connection. Any ideas about where to start looking in your code, awesomium or chromium? Any helpers would be much apreciated.
Roman // November 2, 2009 at 7:33 am |
Chris, I’m using RenderTargetBitmap to get frames now but not sure that it can provide required speed for video capture… Maybe your wrapper can provide better/correct way?
Laurent // November 2, 2009 at 8:16 am |
Hello Chris,
I’ve tried the install from this page : http://www.chriscavanagh.com/chris/Cjc.ThreeDeemium/publish.htm
If I start from web browser or from the start menu, when I click on the Get Started button, it loads until 100% is displayed, then, after 3 seconds, the inner part of the window gets black, and the mouse cursor shape change to the “busy” animation (the animated blue circle of Vista).
I’ve updated the source code from codeplex, build it, then tried the Cjc.Chromium, and it still hangs….
I’ve paused the execution, and I noticed that the browser is stopped at the following method : in the AwesomiumWrapper.h file, WebView class, method : Render, line of code 424 : Rect^ result = gcnew Rect();
It also works on google chrome v. 3.0.195.27.
Do you have any idea of what happens ?
Thanks in advance,
Laurent.
Chris Cavanagh // November 2, 2009 at 9:13 am |
Roman – Have you tried WriteableBitmap? That’s what the WebBrowser control uses internally (might expose it as a property too as I recall). Create the WriteableBitmap once (resize it as your window/container resizes) and just let AwesomiumWrapper write to it. Awesomium is fairly efficient in only updating the “changed” parts of the bitmap (use the Rect that Render returns to determine where to update).
Chris Cavanagh // November 2, 2009 at 9:16 am |
Laurent – How large is the window you’re using? Do most other Flash sites you’ve tried work ok?
Roman // November 2, 2009 at 11:02 am |
Hi Chris
Thank you!
Can you give me small sample of WriteableBitmap usage with WebBrowser control?
Pichit Saejung // November 3, 2009 at 4:18 am |
Hi,
Everything work well but it without proxy setting.
Thank you.
tung // November 3, 2009 at 4:56 am |
Hi Chris,
the language asia can’t input in webbrowser, can you tell me how does it fix.
i input korean language ex: 화ㅂㅈ댁셔 ㅎㄴ앟 ㅘㄱ샐 인뎋
but it does not appear (i type in google site).
tung // November 3, 2009 at 9:42 pm |
Hi Chirs, in http://code.google.com/p/chromiumembedded/downloads/list
this project write by VC++ and use input keyboard icudt42.dll and i can input my korean language, that is reason, is isn’t it.
Ronny // November 5, 2009 at 8:06 am |
The Awesomium_d.zip download link doesn’t work
Ian Boyd // November 5, 2009 at 8:41 am |
So i zoom in, and text, buttons, and scrollbars get fuzzy. Is it not a WPF-based browser?
Chris Cavanagh // November 5, 2009 at 9:19 am |
Ian – It’s a WPF control wrapping a C++ library (Awesomium + Chromium). Currently scrollbars are rendered by the C++ as part of the bitmap (based on the size constraints given). If Awesomium could tell us its current virtual page size we could size a bitmap appropriately and do the scrolling in WPF instead. I’ve mailed Awesomium’s author to see if this could be added.
Chris Cavanagh // November 5, 2009 at 9:21 am |
Ronny – My bad
I’ve updated the link in the article to this one:
http://www.chriscavanagh.com/chris/Cjc.ThreeDeemium/Awesomium_d.zip
Ronny // November 5, 2009 at 7:10 pm |
Thanks
Roman // November 6, 2009 at 1:45 am |
Hi Chris
Can you give me small sample of WriteableBitmap usage with WebBrowser control (to get snapshots)?
Chris Cavanagh // November 6, 2009 at 9:30 am |
Roman – Sorry for my slow reply… I’ve added a “ContentChanged” event to the WebBrowser control, and also exposed “Bitmap” as a read-only DependencyProperty. The updated source is on CodePlex but I’ve not tested it at all, so looks like you’re now a beta tester
If you use the ContentChanged event, ContentChangedEventArgs includes a Rect property describing the updated region (or the entire region if EnableAsyncRendering=true).
Let me know if it helps!
Chris Cavanagh // November 6, 2009 at 9:34 am |
Roman – You’ll still need to figure out how to get the content from the WriteableBitmap, but that should be pretty straightforward.
Another way to capture the browser image is with RenderTargetBitmap. Just create one and call its Render method, passing it the WebBrowser control. However using the new Bitmap property should be more efficient
Roman // November 6, 2009 at 12:14 pm |
Thanks! I will check it soon!
Sven // November 6, 2009 at 12:32 pm |
Ho Chris,
this is just awesome
I am just embedding Chromium in my next release of my client for Google Reader (as the frame control is just a mess…).
I am curious if the embedded DLLs in your example app are the most current ones? If not could you provide them as a compiled download as my VS Express is unable to compile mixed C++ and C#
With the DLLs I am currently using I stumbled across a strange error – everything seems to be fine – I am able to render anything I like, follow links by clicking on them and so on. But if I double click anywhere with the control it crashes my app – any idea…?
Can’t believe how fast Chromium is – seems I need to change my default browser now
Chris Cavanagh // November 6, 2009 at 12:37 pm |
Sven – Those are the latest binaries we can currently get. However, Awesomium 1.5 is due imminently (and has been for some time
) so hopefully that’ll improve things.
As for double-clicking, I shamefully admit I’ve never tried double-clicking my control
I’ll go kick it around and see if it’s something I can fix
Sven // November 6, 2009 at 1:21 pm |
Wow – what a fast response
DoubleClicking in your example app is no problem – it just happens to crash in my one in this case
Chris Cavanagh // November 6, 2009 at 1:36 pm |
Sven – Hmm… Can you get a stack trace from the crash & send / paste it me?
Sven // November 6, 2009 at 1:55 pm |
Strange enough there is no stacktrace even if I start it in debugging – I just get the Winsows “vhost.exe has stopped working” alert and then it simply ends. But I have some data in the EventLog I put at the end of this comment. Additionally I am just uploading my full project right now to Codeplex so if you want you can see it live in a few minutes at http://desktopgooglereader.codeplex.com/SourceControl/ListDownloadableCommits.aspx …
Event Log:
Faulting application name: DesktopGoogleReader.vshost.exe, version: 9.0.30729.1, time stamp: 0×488f1c9b
Faulting module name: Awesomium.dll, version: 0.0.0.0, time stamp: 0×4a0e61b7
Exception code: 0xc0000005
Fault offset: 0×001fba5f
Faulting process id: 0xc34
Faulting application start time: 0×01ca5f19eb29e751
Faulting application path: C:\Users\Sven\Documents\Development\Desktop Google Reader\DesktopGoogleReader\bin\Debug\DesktopGoogleReader.vshost.exe
Faulting module path: C:\Users\Sven\Documents\Development\Desktop Google Reader\DesktopGoogleReader\bin\Debug\Awesomium.dll
Report Id: 5f8fa3cb-cb0d-11de-8a04-00164192cd67
*******************************
Fault bucket , type 0
Event Name: APPCRASH
Response: Not available
Cab Id: 0
Problem signature:
P1: DesktopGoogleReader.vshost.exe
P2: 9.0.30729.1
P3: 488f1c9b
P4: Awesomium.dll
P5: 0.0.0.0
P6: 4a0e61b7
P7: c0000005
P8: 001fba5f
P9:
P10:
Sven // November 6, 2009 at 2:57 pm |
Project now uploaded to http://desktopgooglereader.codeplex.com/SourceControl/ListDownloadableCommits.aspx – if you have a Google Reader account you could login, change within the preferences to use Chromium (please login first – just fixed a bug there after upload) and play a little bit in the content area – I normally get crashes quite fast when reading full articles and double (or more) clicking in the Browser.
If you like you can get me at Google Talk with PidginSnarl@googlemail.com
Roman // November 7, 2009 at 6:57 am |
Hi
mmm, why new Bitmap property is null? Am I need to specify another property or catch event or something like it?
Chris Cavanagh // November 7, 2009 at 9:23 am |
Roman – I’ve still not tested it :$ But it’s likely Bitmap will be null until the first render happens… Try attaching to the ContentChanged event and see if Bitmap is non-null by then…
Roman // November 7, 2009 at 11:07 am |
Thanks, I’ll try.
Michael Sync // November 9, 2009 at 3:20 am |
You did great job..
But here are the things that you may want to consider..
Awesomium is no longer open source. The author of Awesomium wrote about this in this post http://princeofcode.com/blog/?p=267.
But according to the comment of this post, he said that old version of his library will remain under LGPL (No commercial )..
future release started from 1.5 might not be free.
Good luck,
Roman // November 9, 2009 at 3:28 am |
Hm, LGPL for older version is not so bad. Maybe somebody will continue this open-source work.
Chris Cavanagh // November 9, 2009 at 8:29 am |
Michael, Roman – Adam’s made a few comments lately about Awesomium licensing. We’ll need to see how it pans out. At least what we have already is “ok” for most non-commercial stuff (obviously it’ll fall behind as Chromium/Awesomium evolves). For more serious stuff you’d probably want a license anyway. Alternatively someone could take the most recent [Awesomium] LGPL source and bring it up to date with Chromium, then maintain it as a separate project. I’d be happy to keep this WebBrowser up-to-date with that; we just need someone to volunteer for the C++ stuff
(I’ve served my time already; happily a hazy memory).
Roman // November 9, 2009 at 11:07 am |
Commercial license is ok, I just worried about your wrapper future. I hope it’ll support latest awesomium features and so on.
Roman // November 10, 2009 at 10:34 am |
Hi Chris
Sorry, but Bitmap property always null, I do not understood how to fix it. Please give me small sample with Bitmap correct usage or something like it.
Michael Sync // November 12, 2009 at 8:09 pm |
Actually, what I think is that somone bring most recent [Awesomium] LGPL source and port it the managed code.
so, it allows a lot of .NET developers to contribute the project.
Mattias Konradsson // November 12, 2009 at 11:22 pm |
Hi, could you perhaps post a compiled version of the latest release of the wrapper and browser on Plex? I’m having a hell of a time trying to compile the C++ stuff, would be much appreciated, thanks!
Chris Cavanagh // November 13, 2009 at 1:15 am |
Michael – We should look into that… Any volunteers?
Chris Cavanagh // November 13, 2009 at 1:18 am |
Mattias – Did you try the zipped binaries?
http://www.chriscavanagh.com/chris/Cjc.ThreeDeemium/Cjc.ChromiumBrowserDemo.zip
You can get Awesomium_d.dll (needed for debug build) from here:
http://www.chriscavanagh.com/chris/Cjc.ThreeDeemium/Awesomium_d.zip
That should be everything you need…
Mattias Konradsson // November 13, 2009 at 2:12 am |
Awesome, thanks! This control really opens up some interesting possibilities.
Fredrik // November 13, 2009 at 7:19 am |
Hello. Thanks for a great app, nice to not be restricted to IE for internal app web browsing.
Is there any methode to capture the html \ stream of the webpage after it has been loaded?
Chris Cavanagh // November 13, 2009 at 8:34 am |
Fredrik – The AwesomiumWrapper has a GetContentAsText method which wasn’t previously exposed on WebBrowser. Now it is (check CodePlex)
Chris Cavanagh // November 13, 2009 at 9:02 am |
Roman – Sorry
The Bitmap property is now assigned correctly (latest on CodePlex)
Roman // November 13, 2009 at 9:24 am |
Chris, how I can contribute some code? I wrote update that allow me to get current image as byte[] without memory copiing…
Fredrik // November 13, 2009 at 9:44 am |
Thanks a bunch Chris!
Sven // November 13, 2009 at 11:24 am |
Great work Chris – I really love having the option to use Chromium instead of IE within my Google Reader. Did you have time to have a look in my DoubleClick problem?
And could you upload the compiled anywhere as I only have VS Express and can’t compile cross language projects (C++ *or* C#).
Once again thanks – planning to release my first official version with your WebBrowser included tomorrow
Chris Cavanagh // November 15, 2009 at 1:35 pm |
Roman – If you send me a CodePlex username I’ll add you as a developer
Chris Cavanagh // November 15, 2009 at 1:46 pm |
Sven – Sorry for my slow reply. Your Google Reader is awesome
I installed it and get the same double-click problem. I’ll try running it from source and see if I can narrow down the problem…
Roman // November 15, 2009 at 1:49 pm |
username is geneziz
WPF 3D Chromium Browser « Chris Cavanagh’s Blog // November 17, 2009 at 3:24 pm |
[...] an updated version of YouCube (WPF 3D Web Browser) available based on my Awesomium / Chromium control. Try it [...]
Meekal Bajaj // November 21, 2009 at 12:24 pm |
Great work Chris!
Are there equivalents of InvokeScript and ObjectForScripting for working with the HTML?
Thanks, Meekal
Chris Cavanagh // November 21, 2009 at 7:17 pm |
Meekal – The ExecuteJavascript*, SetProperty and SetCallback methods on the WebBrowser control should be of use: http://wpfchromium.codeplex.com/SourceControl/changeset/view/34570#413984
Hope this helps!
Meekal Bajaj // November 22, 2009 at 12:38 pm |
Thanks for getting back to me, Chris. But, I cant seem to get it to work.
I take it the comments box doesn’t allow markup/scripts, so I put up my sample code at
http://www.cc.gatech.edu/~meekal/comment.txt
I would really appreciate it if you could take a look. Thanks!