diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md index afb97ce43429073227f53a53f7d7982eb069776a..a3781242346241c0874800558095b6c205a0a0c2 100755 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md @@ -1232,7 +1232,7 @@ struct WebComponent { } ``` -### allowWindowOpenMethod9+ +### allowWindowOpenMethod10+ allowWindowOpenMethod(flag: boolean) @@ -2080,11 +2080,12 @@ onScaleChange(callback: (event: {oldScale: number, newScale: number}) => void) } ``` -### onUrlLoadIntercept +### onUrlLoadIntercept(deprecated) onUrlLoadIntercept(callback: (event?: { data:string | WebResourceRequest }) => boolean) 当Web组件加载url之前触发该回调,用于判断是否阻止此次访问。默认允许加载。 +从API version 10开始不在维护,建议使用[onLoadIntercept10+](#onloadintercept10)代替。 **参数:** @@ -3100,7 +3101,7 @@ onAudioStateChanged(callback: (event: { playing: boolean }) => void) ### onLoadIntercept10+ -onLoadIntercept(callback: (event?: { request: WebResourceRequest }) => boolean) +onLoadIntercept(callback: (event?: { data: WebResourceRequest }) => boolean) 当Web组件加载url之前触发该回调,用于判断是否阻止此次访问。默认允许加载。 @@ -3130,11 +3131,11 @@ onLoadIntercept(callback: (event?: { request: WebResourceRequest }) => boolean) build() { Column() { Web({ src: 'www.example.com', controller: this.controller }) - .onUrlLoadIntercept((event) => { - console.log('url:' + event.request.getRequestUrl()) - console.log('isMainFrame:' + event.request.isMainFrame()) - console.log('isRedirect:' + event.request.isRedirect()) - console.log('isRequestGesture:' + event.request.isRequestGesture()) + .onLoadIntercept((event) => { + console.log('url:' + event.data.getRequestUrl()) + console.log('isMainFrame:' + event.data.isMainFrame()) + console.log('isRedirect:' + event.data.isRedirect()) + console.log('isRequestGesture:' + event.data.isRequestGesture()) return true }) } @@ -3340,6 +3341,18 @@ isRequestGesture(): boolean | ------- | -------------------- | | boolean | 返回资源请求是否与手势(如点击)相关联。 | +### getRequestMethod9+ + +getRequestMethod(): string + +获取请求方法。 + +**返回值:** + +| 类型 | 说明 | +| ------- | -------------------- | +| string | 返回请求方法。 | + ## Header Web组件返回的请求/响应头对象。