Loading local web page into Webkit WebView (original) (raw)

I want to load a local web page into WebKit.WebView. Is it possible to use the .load_uri instance method to load a local HTML page bundled as a resource like so:

webView.load_uri("resource:///res/path/web_view_demo/web/index.html")

So far, the only way I was able to load it is by first extracting the markup in string format and using webView.load_html.

Even then, I’m unable to load static assets such as images bundled as resource. It is only possible when I embed the image as data URL. I guess my question is whether there is a way of loading markup bundled as resource and is it possible to load images bundled as resource into the loaded web page.

two May 29, 2025, 8:56pm 2

webviews run in a separate process, so they don’t know about your resources

but you can register a url scheme:

and make it forward the resources and then load_uri("your-scheme:///index.html")

system (system) Closed June 12, 2025, 8:57pm 3

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.