Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the meaning of the web compartment in UWP?

Tags:

uwp

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?

like image 480
djm181 Avatar asked Nov 07 '22 03:11

djm181


1 Answers

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).

like image 173
Nico Zhu - MSFT Avatar answered Nov 27 '22 03:11

Nico Zhu - MSFT