Trials and tribulations with WebKit

This post is about issues that pop up after you’ve got WebKit compiled and can get an application up and running within initialization errors.

(fyi, these are issues I’ve had on Win32. Things may be different on other platforms)

Issue 1: Safari theme doesn’t work, causes crash
If, like me, you’ve just copied the other necessary DLLs needed by WebKit from your Safari directory, SafariTheme.dll will cause you trouble (crash) unless you copy over the \SafariTheme.resources folder as well.

Note that WebKit will work fine without the Safari theme. Simply, get rid of the SafariTheme.dll file and a default theme will be used (it’s ugly, but it’s functional). Also, note that I’m not sure what the copyrights/license is for the Safari theme, there may be restrictions on using and/or distributing it.

Issue 2: “localized string not found” in context menus
Go to folder where you have the WebKit source. Navigate to WebKit\win. There you’ll find the \WebKit.resources folder, copy it to the folder with your WebKit DLL. Next, copy \English.lproj into the copied \WebKit.resources folder.

So, in the directory with your WebKit DLL, you should have:

Issue 3: loadURL() does nothing
If your using the WinLauncher application as guide, you’ll notice the loadURL() function doesn’t seem to work. This is because the timeout interval passed to the initWithURL() member is 0. A value of 60 (seconds?) seems to work well.

request->initWithURL(urlBStr, WebURLRequestUseProtocolCachePolicy, 60);

That’s it for now. In the next few days, I’ll post how to wrap WebKit and embed it within a WinForms application; screenshot below.

WebKit in C# WinForms application

Leave a Reply