• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Using Implicit Want to Open a Website
2
3This section uses the operation of using a browser to open a website as an example. It is assumed that one or more browser applications are installed on the device. To ensure that the browser application can work properly, configure the [module.json5 file](../quick-start/module-configuration-file.md) as follows:
4
5```json
6{
7  "module": {
8    // ...
9    "abilities": [
10      {
11        // ...
12        "skills": [
13          {
14            "entities": [
15              "entity.system.home",
16              "entity.system.browsable"
17              // ...
18            ],
19            "actions": [
20              "action.system.home",
21              "ohos.want.action.viewData"
22              // ...
23            ],
24            "uris": [
25              {
26                "scheme": "https",
27                "host": "www.test.com",
28                "port": "8080",
29                // Prefix matching is used.
30                "pathStartWith": "query"
31              },
32              {
33                "scheme": "http",
34                // ...
35              }
36              // ...
37            ]
38          }
39        ]
40      }
41    ]
42  }
43}
44```
45
46In the initiator UIAbility, use implicit Want to start the browser application.
47
48```ts
49import common from '@ohos.app.ability.common';
50
51function implicitStartAbility() {
52  let context = getContext(this) as common.UIAbilityContext;
53  let wantInfo = {
54    // Uncomment the line below if you want to implicitly query data only in the specific bundle.
55    // bundleName: 'com.example.myapplication',
56    'action': 'ohos.want.action.viewData',
57    // entities can be omitted.
58    'entities': ['entity.system.browsable'],
59    'uri': 'https://www.test.com:8080/query/student'
60  }
61  context.startAbility(wantInfo).then(() => {
62    // ...
63  }).catch((err) => {
64    // ...
65  })
66}
67```
68
69The matching process is as follows:
70
711. If **action** in the passed **want** parameter is specified and is included in **actions** under **skills** of the ability to match, the matching is successful.
722. If **entities** in the passed **want** parameter is specified and is included in **entities** under **skills** of the ability to match, the matching is successful.
733. If **uri** in the passed **want** parameter is included in **uris** under **skills** of the ability to match, which is concatenated into https://www.test.com:8080/query* (where * is a wildcard), the matching is successful.
744. If **type** in the passed **want** parameter is specified and is included in **type** under **skills** of the ability to match, the matching is successful.
75
76If there are multiple matching applications, the system displays a dialog box for you to select one of them. The following figure shows an example.
77
78![stage-want1](figures/stage-want1.png)
79