On 18 December 2012 17:36, y w <ytra...@yahoo.com> wrote: > Hi All, > > I am using WebKit with GTK port in Ubuntu. My project is to get the > domtree of a webpage and save it in background. I do not need to download > the external resources of the page(such as images, script files and css > files) but need save the url of this resources. > I am using WebKit GTK create a webview to load the page, the problem is it > always open a window and start display all resources even if I hide the > hide window. > > Q1; > How can I create the webview without attach it to a window? > In this example [1] I managed to use a WebView without a window. Although you you might want to either use an xserver that runs on a framebuffer [2] and to put the webview in a window or to use a GtkOffscreenWindow [3] instead of a window.
I had mixed results when using an offscreen window with a webview. I got the best results when I use a standard gtk window and run the program in a framebuffer xserver. > Q2: > How should I do if I do not want to download external resources? > You can connect to a webview's signal 'resource-request-starting' and decide if you want to allow the extra resources to be downloaded or not. To reject a resource set the request's uri to "about:blank" Take a look at this sample program [4] [1] https://github.com/potyl/Webkit/blob/master/dom-walker.c [2] https://github.com/potyl/Webkit/blob/master/off-screen.sh [3] http://developer.gnome.org/gtk3/3.0/GtkOffscreenWindow.html [4] https://github.com/potyl/Webkit/blob/master/nanny.pl I hope that it helps. Emmanuel Rodriguez
_______________________________________________ webkit-help mailing list webkit-help@lists.webkit.org http://lists.webkit.org/mailman/listinfo/webkit-help