-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not allowed to load local resource: <URL> #456
Comments
is that webview2 control < default setup ? |
Not sure what you mean by default setup, but I'm not doing anything special to load the page. |
did you try to load local resources such as picture or video files? |
Yes, the screenshot has an image, also navigated to page with video, all working as expected. |
@xblack0 Accessing local files with the "file:" protocol is expected to work in WebView2. Can you share some code where you are trying to do this or a sample app? The file url needs to be an absolute path to the file, and your app needs to have read access on the file. So if you are building a UWP app, for example, your file needs to be in your app's folders (like app data, etc.). Another thing to check is that the file exists where you think it does. Are you deploying your files to the place your app is looking for them? |
Thanks for the added info. This is a security restriction built-into Chromium/Edge. Essentially http: served pages cannot access file: served content. Are other parts of your web ui using the http: protocol? There are workarounds described on StackOverflow: |
my application completely out of Http, I am using webview 2 as an interface instead of normal winform (.net vb) |
Pages created with I couldn't find a work-around. Using flags like |
there is a workaround, use the native app to load the resource file and injected it into your code, |
@nnemkin You can also try using the new virtual mapping API (in 1.0.781-prerelease SDK): This should allow you to specify a domain to instead reference a file location. |
Does any one find a way ? or got same this issue ?
The text was updated successfully, but these errors were encountered: