| src | [ResourceStr](ts-types.md) | Yes | Address of a web page resource. To access local resource files, use the **$rawfile** or **resource** protocol.|
| src | [ResourceStr](ts-types.md) | Yes | Address of a web page resource. To access local resource files, use the **$rawfile** or **resource** protocol. To load a local resource file in the sandbox outside of the application package, use **file://** to specify the path of the sandbox.|
| controller | [WebviewController<sup>9+</sup>](../apis/js-apis-webview.md#webviewcontroller)\|[WebController](#webcontroller) | Yes | Controller. **WebController** is deprecated since API version 9. You are advised to use **WebviewController** instead.|
Example of loading local resource files in the sandbox:
1. Use[globalthis](../../application-models/uiability-data-sync-with-ui.md#using-globalthis-between-uiability-and-page) to obtain the path of the sandbox.
The following uses **filesDir** as an example to describe how to obtain the path of the sandbox. For details about how to obtain other paths, see [Obtaining the Application Development Path](../../application-models/application-context-stage.md#obtaining-the-application-development-path).
```ts
// xxx.ts
importUIAbilityfrom'@ohos.app.ability.UIAbility';
importweb_webviewfrom'@ohos.web.webview';
exportdefaultclassEntryAbilityextendsUIAbility{
onCreate(want,launchParam){
// Bind filesDir to the globalThis object to implement data synchronization between the UIAbility component and the UI.
globalThis.filesDir=this.context.filesDir
console.log("Sandbox path is "+globalThis.filesDir)
}
}
```
```html
<!-- index.html -->
<!DOCTYPE html>
<html>
<body>
<p>Hello World</p>
</body>
</html>
```
## Attributes
...
...
@@ -2996,6 +3034,50 @@ Registers a callback for audio playback status changes on the web page.