File tree Expand file tree Collapse file tree 4 files changed +13
-14
lines changed
functional-samples/cookbook.permissions-addhostaccessrequest Expand file tree Collapse file tree 4 files changed +13
-14
lines changed Original file line number Diff line number Diff line change 1
- # permissions.addSiteAccessRequest () Demo
1
+ # permissions.addHostAccessRequest () Demo
2
2
3
- This sample demonstrates using the ` permissions.addSiteAccessRequest ` API to request access to a site .
3
+ This sample demonstrates using the ` permissions.addHostAccessRequest ` API to request access to a host .
4
4
5
5
## Overview
6
6
@@ -11,11 +11,10 @@ This API allows you to request access to an origin listed in `optional_host_perm
11
11
1 . Clone this repository.
12
12
2 . Make sure you have the latest version of Chrome Canary installed.
13
13
3 . At chrome://flags, enable the "Extensions Menu Access Control" flag.
14
- 4 . Close Chrome Canary.
15
- 5 . Start Chrome Canary with the ` --enable-features=ApiPermissionsSiteAccessRequests ` flag.
16
- 6 . Load this directory as an [ unpacked extension] ( https://developer.chrome.com/docs/extensions/mv3/getstarted/development-basics/#load-unpacked ) .
17
- 7 . At chrome://extensions, click on "Details" for the extension and unselect "Automatically allow access on the following sites".
18
- 8 . Visit https://example.com/checkout .
19
- 9 . Click "Allow 1?"
14
+ 4 . Restart Chrome Canary.
15
+ 5 . Load this directory as an [ unpacked extension] ( https://developer.chrome.com/docs/extensions/mv3/getstarted/development-basics/#load-unpacked ) .
16
+ 6 . At chrome://extensions, click on "Details" for the extension and unselect "Automatically allow access on the following sites".
17
+ 7 . Visit https://example.com/checkout .
18
+ 8 . Click "Allow 1?"
20
19
21
20
You will see a banner injected on the page to show that the extension has run.
Original file line number Diff line number Diff line change 13
13
// limitations under the License.
14
14
15
15
/**
16
- * Adds a site access request if the user visits https://example.com/checkout.
16
+ * Adds a host access request if the user visits https://example.com/checkout.
17
17
* This could be useful for an extension that wishes to offer users coupons or
18
18
* order tracking but needs access to the site to do so.
19
19
*/
@@ -33,9 +33,9 @@ chrome.tabs.onUpdated.addListener(async (tabId, changes) => {
33
33
return ;
34
34
}
35
35
36
- // Add a site access request if the API is available.
37
- if ( chrome . permissions . addSiteAccessRequest ) {
38
- chrome . permissions . addSiteAccessRequest ( { tabId } ) ;
36
+ // Add a host access request if the API is available.
37
+ if ( chrome . permissions . addHostAccessRequest ) {
38
+ chrome . permissions . addHostAccessRequest ( { tabId } ) ;
39
39
}
40
40
}
41
41
} ) ;
File renamed without changes.
Original file line number Diff line number Diff line change 1
1
{
2
- "name" : " Permissions (Add Site Access Request)" ,
3
- "description" : " Uses the `permissions.addSiteAccessRequest ()` API to request access to a site." ,
2
+ "name" : " Permissions (Add Host Access Request)" ,
3
+ "description" : " Uses the `permissions.addHostAccessRequest ()` API to request access to a site." ,
4
4
"version" : " 0.3" ,
5
5
"background" : {
6
6
"service_worker" : " background.js"
You can’t perform that action at this time.
0 commit comments