The MSDN docs for UWP uri schemes differentiates ms-appx
and ms-appx-web
with this line:
The ms-appx-web scheme accesses the same files as ms-appx, but in the web compartment.
What is the web compartment and how does this impact the rest of the application? It seems a web view can only access content from this compartment - why is this?
What is the web compartment and how does this impact the rest of the application?
The short answer, it is by design. Loading local HTML resources is very much limited unless they are distributed along with the application. To load content from the your app package, use the Navigate
method with a Uri that uses the ms-appx-web
scheme. For security reason, load html file from app package you must use ms-appx-web
.
Just imagine, if html could use ms-appx
to access local api without limit, you app will be unsafe. So, you could think ms-appx-web
is accessed with security restrictions. And the official document also confirms this (web compartment).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With