File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4242 <toc-element topic =" bindings-api.md" />
4343 <toc-element topic =" data-api.md" />
4444 <toc-element topic =" web-components-api.md" />
45+ <toc-element topic =" security-api.md" />
4546 </toc-element >
4647 <toc-element topic =" events.md" />
4748 </toc-element >
Original file line number Diff line number Diff line change 1+ # Security API
2+
3+ <show-structure for =" chapter " depth =" 2 " />
4+
5+ This API provides information about
6+ [ security context] ( https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts )
7+ used to access [ other APIs] ( https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts/features_restricted_to_secure_contexts ) .
8+
9+ The API is available in the ` WebView::$security ` property.
10+
11+ ``` php
12+ $app = new Boson\Application();
13+
14+ $app->webview->security; // Access to Security API
15+ ```
16+
17+ <note >
18+ Your context will most likely be <b >secure</b > if you don't use the
19+ <code >data:</code > or <code >about:</code > protocol schemes
20+ </note >
21+
22+ ## Current Context
23+ <secondary-label ref =" read-only " />
24+
25+ To get the current security status you can use the read-only
26+ ` $isSecureContext ` property.
27+
28+ ``` php
29+ $isSecure = $app->webview->security->isSecureContext;
30+
31+ echo 'Context is ' . ($isSecure ? 'secure' : 'insecure');
32+ ```
You can’t perform that action at this time.
0 commit comments