webview_deno
webview_deno copied to clipboard
Cannot render local images
Local images are not rendered - neither using absolute or relative paths
<img src="butter.png" alt="some issue" width="900" height="700">
Or am I doing something wrong?
there are no http server i guess. try to use one
@panaC I was trying to avoid a server.
I also tried using something like <img src="file:///home/me/butter.png" alt="some issue" width="900" height="700">
but I get: "CONSOLE SECURITY ERROR Not allowed to load local resource."
I don't see this as a security issue if you run deno with --allow-read
Why would it work for NW.js (https://github.com/nwjs/nw.js/issues/5499) but not for webview_deno?
@ovidiu141 this is just the way webview is implemented in the operating system. I'm using webview2 (Windows) directly from Rust:
There is sandbox etc. in front, you need server if you want it to be portable. Not all OS's allow to show file://
images in webview.
Edit There seems to be issue in Microsoft's webview2 repo to enable this: https://github.com/MicrosoftEdge/WebView2Feedback/issues/642
So it looks like the fix is to set CoreWebView2EnvironmentOptions "--allow-file-access-from-files".
Webview takes an env_options when using WebView2 (windows), so maybe it can be sent when creating it.