|
|
+
+使用说明
+
+1. 在Web组件的onAppear中对要加载的页面进行预连接。
+1. 点击超链接跳转下一界面。
+1. 点击loadData按钮返回上个界面。
+
+### Entry1:
+
+#### PrepareForPageLoad_two
+
+##### 介绍
+
+1. 本示例主要介绍加速Web页面的访问,可以通过initializeBrowserEngine()来提前初始化内核,然后在初始化内核后调用 prepareForPageLoad()对即将要加载的页面进行预解析、预连接。
+##### 效果预览
+
+| 主页 | loadDate |
+| ------------------------------------------------------------ | ------------------------------------------------------------ |
+|
|
|
+
+使用说明
+
+1. Ability的onCreate中提前初始化Web内核并对首页进行预连接。
+
+### Entry2:
+
+#### Prefetching
+
+##### 介绍
+
+1. 本示例主要介绍加速Web页面的访问,如果能够预测到Web组件将要加载的页面或者即将要跳转的页面,可以通过prefetchPage()来预加载即将要加载页面。
+
+##### 效果预览
+
+| 主页 |
+| -------------------------------------------------------- |
+|
|
+
+使用说明
+
+1. 在onPageEnd的时候触发下一个要访问的页面的预加载。
+
+#### PrefetchingAPOSTRequest_one
+
+##### 介绍
+
+1. 本示例主要介绍加速Web页面的访问,通过prefetchResource()预获取将要加载页面中的post请求。在页面加载结束时,可以通过clearPrefetchedResource()清除后续不再使用的预获取资源缓存。
+
+##### 效果预览
+
+| 主页 |
+| ------------------------------------------------------------ |
+|
|
+
+使用说明
+
+1. 对要加载页面中的post请求进行预获取。在onPageEnd中,可以清除预获取的post请求缓存。
+
+#### PrefetchingAPOSTRequest_two
+
+##### 介绍
+
+1. 本示例主要介绍加速Web页面的访问,如果能够预测到Web组件将要加载页面或者即将要跳转页面中的post请求。可以通过prefetchResource()预获取即将要加载页面的post请求。
+
+##### 效果预览
+
+| 主页 |
+| ------------------------------------------------------------ |
+|
|
+
+使用说明
+
+1. 在onPageEnd中,触发预获取一个要访问页面的post请求。
+
+#### PrefetchingAPOSTRequest_three
+
+##### 介绍
+
+1. 本示例主要介绍加速Web页面的访问,通过initializeBrowserEngine()提前初始化内核,然后在初始化内核后调用prefetchResource()预获取将要加载页面中的post请求。这种方式适合提前预获取首页的post请求。
+
+##### 效果预览
+
+| 主页 |
+| ------------------------------------------------------------ |
+|
|
+
+使用说明
+
+1. 在Ability的onCreate中,提前初始化Web内核并预获取首页的post请求。
+
+### Entry3:
+
+#### PrecompForCompCache
+
+##### 介绍
+
+1. 本示例主要介绍加速Web页面的访问,通过precompileJavaScript()在页面加载前提前生成脚本文件的编译缓存。
+
+##### 效果预览
+
+| 主页 | 加载页面 |
+| ------------------------------------------------------------ | ------------------------------------------------------------ |
+|
|
|
+
+使用说明
+
+1. 应用启动时EntryAbility将UIContext存到localstorage,初始化预编译Web组件生成编译缓存。
+2. 点击加载页面按钮,创建businessNode,加载业务用Web组件展示business.html页面,此时会使用之前生成的编译缓存。
+
+### Entry4:
+
+#### InjOffResNoInt
+
+##### 介绍
+
+1. 本示例主要介绍加速Web页面的访问,可以通过injectOfflineResources()在页面加载前提前将图片、样式表或脚本资源注入到应用的内存缓存中。
+
+##### 效果预览
+
+| 主页 | 加载页面 |
+| ------------------------------------------------------------ | ------------------------------------------------------------ |
+|
|
|
+
+使用说明
+
+1. 进入Index.ets页面自动触发aboutToAppear方法。
+2. 点击加载页面按钮创建businessNode,加载业务用Web组件,展示business.html页面。
+
+### 工程目录
+
+```
+entry/src/main/
+|---ets
+|---|---entryability
+|---|---|---EntryAbility.ets
+|---|---pages
+|---|---|---Index.ets // 首页
+|---resources // 静态资源
+|---ohosTest
+|---|---ets
+|---|---|---tests
+|---|---|---|---Ability.test.ets // 自动化测试用例
+
+entry1/src/main/
+|---ets
+|---|---entryability
+|---|---|---EntryAbility.ets
+|---|---pages
+|---|---|---Index.ets // 首页
+|---resources // 静态资源
+|---ohosTest
+|---|---ets
+|---|---|---tests
+|---|---|---|---Ability.test.ets // 自动化测试用例
+
+entry2/src/main/
+|---ets
+|---|---entryability
+|---|---|---EntryAbility.ets
+|---|---pages
+|---|---|---Index.ets // 首页
+|---|---|---Prefetching.ets
+|---|---|---PrefetchingAPOSTRequest_one.ets
+|---|---|---PrefetchingAPOSTRequest_three.ets
+|---|---|---PrefetchingAPOSTRequest_two.ets
+|---resources // 静态资源
+|---ohosTest
+|---|---ets
+|---|---|---tests
+|---|---|---|---Ability.test.ets // 自动化测试用例
+
+entry3/src/main/
+|---ets
+|---|---entryability
+|---|---|---EntryAbility.ets
+|---|---pages
+|---|---|---BusinessWebview.ets
+|---|---|---DynamicComponent.ets
+|---|---|---Index.ets // 首页
+|---|---|---PrecompileConfig.ets
+|---|---|---Precompile Webview.ets
+|---resources // 静态资源
+|---ohosTest
+|---|---ets
+|---|---|---tests
+|---|---|---|---Ability.test.ets // 自动化测试用例
+
+entry4/src/main/
+|---ets
+|---|---entryability
+|---|---|---EntryAbility.ets
+|---|---pages
+|---|---|---BusinessWebview.ets
+|---|---|---DynamicComponent.ets
+|---|---|---Index.ets // 首页
+|---|---|---Inject Webview.ets
+|---|---|---Resource.ets
+|---resources // 静态资源
+|---ohosTest
+|---|---ets
+|---|---|---tests
+|---|---|---|---Ability.test.ets // 自动化测试用例
+```
+
+
+### 相关权限
+
+[ohos.permission.INTERNET](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/security/AccessToken/permissions-for-all.md#ohospermissioninternet)
+
+### 依赖
+
+不涉及。
+
+### 约束与限制
+
+1. 本示例仅支持标准系统上运行,支持设备:华为手机。
+
+2. HarmonyOS系统:HarmonyOS 5.0.2 Release及以上。
+
+3. DevEco Studio版本:DevEco Studio 5.0.2 Release及以上。
+
+4. HarmonyOS SDK版本:HarmonyOS 5.0.2 Release及以上。
+
+### 下载
+
+如需单独下载本工程,执行如下命令:
+
+```
+git init
+git config core.sparsecheckout true
+echo ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess > .git/info/sparse-checkout
+git remote add origin https://gitee.com/harmonyos_samples/guide-snippets.git
+git pull origin master
+```
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/build-profile.json5 b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..91a9926d9991ebd0faf86984be0a7f95893101df
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/build-profile.json5
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "app": {
+ "signingConfigs": [],
+ "products": [
+ {
+ "name": "default",
+ "signingConfig": "default",
+ "compatibleSdkVersion": "5.0.2(14)",
+ "targetSdkVersion": "5.0.2(14)",
+ "runtimeOS": "HarmonyOS",
+ }
+ ],
+ "buildModeSet": [
+ {
+ "name": "debug",
+ },
+ {
+ "name": "release"
+ }
+ ]
+ },
+ "modules": [
+ {
+ "name": "entry",
+ "srcPath": "./entry",
+ "targets": [
+ {
+ "name": "default",
+ "applyToProducts": [
+ "default"
+ ]
+ }
+ ]
+ },
+ {
+ "name": "entry1",
+ "srcPath": "./entry1",
+ "targets": [
+ {
+ "name": "default",
+ "applyToProducts": [
+ "default"
+ ]
+ }
+ ]
+ },
+ {
+ "name": "entry2",
+ "srcPath": "./entry2",
+ "targets": [
+ {
+ "name": "default",
+ "applyToProducts": [
+ "default"
+ ]
+ }
+ ]
+ },
+ {
+ "name": "entry3",
+ "srcPath": "./entry3",
+ "targets": [
+ {
+ "name": "default",
+ "applyToProducts": [
+ "default"
+ ]
+ }
+ ]
+ },
+ {
+ "name": "entry4",
+ "srcPath": "./entry4",
+ "targets": [
+ {
+ "name": "default",
+ "applyToProducts": [
+ "default"
+ ]
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/code-linter.json5 b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/code-linter.json5
new file mode 100644
index 0000000000000000000000000000000000000000..28586467ee7a761c737d8654a73aed6fddbc3c71
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/code-linter.json5
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "files": [
+ "**/*.ets"
+ ],
+ "ignore": [
+ "**/src/ohosTest/**/*",
+ "**/src/test/**/*",
+ "**/src/mock/**/*",
+ "**/node_modules/**/*",
+ "**/oh_modules/**/*",
+ "**/build/**/*",
+ "**/.preview/**/*"
+ ],
+ "ruleSet": [
+ "plugin:@performance/recommended",
+ "plugin:@typescript-eslint/recommended"
+ ],
+ "rules": {
+ }
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/.gitignore b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..e2713a2779c5a3e0eb879efe6115455592caeea5
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/.gitignore
@@ -0,0 +1,6 @@
+/node_modules
+/oh_modules
+/.preview
+/build
+/.cxx
+/.test
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/build-profile.json5 b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..e7569e3056e27af38e9991b7ea73ec10f3ba8a05
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/build-profile.json5
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "apiType": "stageMode",
+ "buildOption": {
+ },
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": false,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ }
+ }
+ }
+ },
+ ],
+ "targets": [
+ {
+ "name": "default"
+ },
+ {
+ "name": "ohosTest",
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/hvigorfile.ts b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..98d52319cb1dee60511b5716dba03b76e68a6d8b
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/hvigorfile.ts
@@ -0,0 +1,21 @@
+/*
+* Copyright (c) 2025 Huawei Device Co., Ltd.
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+import { hapTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/obfuscation-rules.txt b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/obfuscation-rules.txt
new file mode 100644
index 0000000000000000000000000000000000000000..272efb6ca3f240859091bbbfc7c5802d52793b0b
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/obfuscation-rules.txt
@@ -0,0 +1,23 @@
+# Define project specific obfuscation rules here.
+# You can include the obfuscation configuration files in the current module's build-profile.json5.
+#
+# For more details, see
+# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
+
+# Obfuscation options:
+# -disable-obfuscation: disable all obfuscations
+# -enable-property-obfuscation: obfuscate the property names
+# -enable-toplevel-obfuscation: obfuscate the names in the global scope
+# -compact: remove unnecessary blank spaces and all line feeds
+# -remove-log: remove all console.* statements
+# -print-namecache: print the name cache that contains the mapping from the old names to new names
+# -apply-namecache: reuse the given cache file
+
+# Keep options:
+# -keep-property-name: specifies property names that you want to keep
+# -keep-global-name: specifies names that you want to keep in the global scope
+
+-enable-property-obfuscation
+-enable-toplevel-obfuscation
+-enable-filename-obfuscation
+-enable-export-obfuscation
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/oh-package.json5 b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..c9cb6c8174858277c9b0d465a51547dcab16d5ff
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/oh-package.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "name": "entry",
+ "version": "1.0.0",
+ "description": "Please describe the basic information.",
+ "main": "",
+ "author": "",
+ "license": "",
+ "dependencies": {}
+}
+
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/main/ets/entryability/EntryAbility.ets b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/main/ets/entryability/EntryAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..82e98bec44d83d2df03deb52508045cb06cc8604
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/main/ets/entryability/EntryAbility.ets
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { window } from '@kit.ArkUI';
+
+export default class EntryAbility extends UIAbility {
+ onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
+ }
+
+ onDestroy(): void {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
+ }
+
+ onWindowStageCreate(windowStage: window.WindowStage): void {
+ // Main window is created, set main page for this ability
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
+
+ windowStage.loadContent('pages/Index', (err) => {
+ if (err.code) {
+ hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
+ return;
+ }
+ hilog.info(0x0000, 'testTag', 'Succeeded in loading the content.');
+ });
+ }
+
+ onWindowStageDestroy(): void {
+ // Main window is destroyed, release UI related resources
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
+ }
+
+ onForeground(): void {
+ // Ability has brought to foreground
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
+ }
+
+ onBackground(): void {
+ // Ability has back to background
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
+ }
+}
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..29feaca7669174be5c2b0e2366529ee94ab7e726
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit';
+
+export default class EntryBackupAbility extends BackupExtensionAbility {
+ async onBackup() {
+ hilog.info(0x0000, 'testTag', 'onBackup ok');
+ }
+
+ async onRestore(bundleVersion: BundleVersion) {
+ hilog.info(0x0000, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion));
+ }
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/main/ets/pages/Index.ets b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/main/ets/pages/Index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..6bf0e4fed027a57256e805bbbeb305052bb0b4be
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/main/ets/pages/Index.ets
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { webview } from '@kit.ArkWeb';
+
+function resourceToString(resource: Resource) {
+ return getContext().resourceManager.getStringSync(resource);
+}
+
+@Entry
+@Component
+struct WebComponent {
+ webviewController: webview.WebviewController = new webview.WebviewController();
+
+ build() {
+ Column() {
+ Button('loadData')
+ .onClick(() => {
+ if (this.webviewController.accessBackward()) {
+ this.webviewController.backward();
+ }
+ })
+ Web({ src: resourceToString($r('app.string.web_path_one')), controller: this.webviewController })
+ .onAppear(() => {
+ // 指定第二个参数为true,代表要进行预连接,如果为false该接口只会对网址进行dns预解析
+ // 第三个参数为要预连接socket的个数。最多允许6个。
+ webview.WebviewController.prepareForPageLoad(resourceToString($r('app.string.web_path_one')), true, 2);
+ })
+ }
+ }
+}
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/main/module.json5 b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/main/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..e9db80c0ac2d7edb8e5ed53f5e5eb5ccbb272a57
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/main/module.json5
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "module": {
+ "name": "entry",
+ "type": "entry",
+ "description": "$string:module_desc",
+ "mainElement": "EntryAbility",
+ "deviceTypes": [
+ "default",
+ "tablet"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false,
+ "pages": "$profile:main_pages",
+ "abilities": [
+ {
+ "name": "EntryAbility",
+ "srcEntry": "./ets/entryability/EntryAbility.ets",
+ "description": "$string:EntryAbility_desc",
+ "icon": "$media:layered_image",
+ "label": "$string:EntryAbility_label",
+ "startWindowIcon": "$media:startIcon",
+ "startWindowBackground": "$color:start_window_background",
+ "exported": true,
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ]
+ }
+ ],
+ "extensionAbilities": [
+ {
+ "name": "EntryBackupAbility",
+ "srcEntry": "./ets/entrybackupability/EntryBackupAbility.ets",
+ "type": "backup",
+ "exported": false,
+ "metadata": [
+ {
+ "name": "ohos.extension.backup",
+ "resource": "$profile:backup_config"
+ }
+ ]
+ }
+ ],
+ "requestPermissions": [
+ {
+ "name": "ohos.permission.INTERNET"
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/main/resources/base/element/color.json b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/main/resources/base/element/color.json
new file mode 100644
index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/main/resources/base/element/color.json
@@ -0,0 +1,8 @@
+{
+ "color": [
+ {
+ "name": "start_window_background",
+ "value": "#FFFFFF"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/main/resources/base/element/string.json b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..65e6e287e05d404b31a376c49615635f654367cf
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,24 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "AcceleratePageAccess"
+ },
+ {
+ "name": "web_path",
+ "value": "https://www.example.com/"
+ },
+ {
+ "name": "web_path_one",
+ "value": "https://www.example.com"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/main/resources/base/media/background.png b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/main/resources/base/media/background.png
new file mode 100644
index 0000000000000000000000000000000000000000..f939c9fa8cc8914832e602198745f592a0dfa34d
Binary files /dev/null and b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/main/resources/base/media/background.png differ
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/main/resources/base/media/foreground.png b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/main/resources/base/media/foreground.png
new file mode 100644
index 0000000000000000000000000000000000000000..4483ddad1f079e1089d685bd204ee1cfe1d01902
Binary files /dev/null and b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/main/resources/base/media/foreground.png differ
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/main/resources/base/media/layered_image.json b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/main/resources/base/media/layered_image.json
new file mode 100644
index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/main/resources/base/media/layered_image.json
@@ -0,0 +1,7 @@
+{
+ "layered-image":
+ {
+ "background" : "$media:background",
+ "foreground" : "$media:foreground"
+ }
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/main/resources/base/media/startIcon.png b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/main/resources/base/media/startIcon.png
new file mode 100644
index 0000000000000000000000000000000000000000..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b
Binary files /dev/null and b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/main/resources/base/media/startIcon.png differ
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/main/resources/base/profile/backup_config.json b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/main/resources/base/profile/backup_config.json
new file mode 100644
index 0000000000000000000000000000000000000000..78f40ae7c494d71e2482278f359ec790ca73471a
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/main/resources/base/profile/backup_config.json
@@ -0,0 +1,3 @@
+{
+ "allowToBackupRestore": true
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/main/resources/base/profile/main_pages.json b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/main/resources/base/profile/main_pages.json
new file mode 100644
index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/main/resources/base/profile/main_pages.json
@@ -0,0 +1,5 @@
+{
+ "src": [
+ "pages/Index"
+ ]
+}
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/main/resources/en_US/element/string.json b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/main/resources/en_US/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..0838a23893a22a87feea786664077715b79cf52e
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/main/resources/en_US/element/string.json
@@ -0,0 +1,16 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "AcceleratePageAccess"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/main/resources/zh_CN/element/string.json b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/main/resources/zh_CN/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..5fd56f1eb0b9b271fbe3be4dc307c05d954eee7b
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/main/resources/zh_CN/element/string.json
@@ -0,0 +1,16 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "模块描述"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "AcceleratePageAccess"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/mock/mock-config.json5 b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/mock/mock-config.json5
new file mode 100644
index 0000000000000000000000000000000000000000..b9a78e201535765168a92d3543c690273ecdc019
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/mock/mock-config.json5
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/ohosTest/ets/test/Ability.test.ets b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/ohosTest/ets/test/Ability.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..4387b1d1e8e1e4e55c8e53794278b34203de2801
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/ohosTest/ets/test/Ability.test.ets
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
+import { abilityDelegatorRegistry, Driver, ON } from '@kit.TestKit';
+import { UIAbility, Want } from '@kit.AbilityKit';
+
+const delegator: abilityDelegatorRegistry.AbilityDelegator = abilityDelegatorRegistry.getAbilityDelegator();
+const bundleName = abilityDelegatorRegistry.getArguments().bundleName;
+export default function abilityTest() {
+ describe('ActsAbilityTest', () => {
+ // Defines a test suite. Two parameters are supported: test suite name and test suite function.
+ beforeAll(() => {
+ // Presets an action, which is performed only once before all test cases of the test suite start.
+ // This API supports only one parameter: preset action function.
+ })
+ beforeEach(() => {
+ // Presets an action, which is performed before each unit test case starts.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: preset action function.
+ })
+ afterEach(() => {
+ // Presets a clear action, which is performed after each unit test case ends.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: clear action function.
+ })
+ afterAll(() => {
+ // Presets a clear action, which is performed after all test cases of the test suite end.
+ // This API supports only one parameter: clear action function.
+ })
+
+ /*
+ * 打开应用
+ * 预解析或者预连接将要加载的页面
+ */
+ it('testUiExample',0, async (done: Function) => {
+ console.info('uitest: TestUiExample begin');
+ const want: Want = {
+ bundleName: bundleName,
+ abilityName: 'EntryAbility'
+ };
+ await delegator.startAbility(want);
+ const driver = Driver.create();
+ await driver.delayMs(1000);
+ const ability: UIAbility = await delegator.getCurrentTopAbility();
+ console.info('get top ability');
+ expect(ability.context.abilityInfo.name).assertEqual('EntryAbility');
+ await driver.delayMs(3000);
+
+ const clickText = await driver.findComponent(ON.type('link'));
+ await clickText.click();
+ await driver.delayMs(3000);
+
+ const button = await driver.findComponent(ON.type('Button'));
+ await button.click();
+ await driver.delayMs(1000);
+
+ const web = await driver.findComponent(ON.type('Web'));
+ let src: string = await web.getText();
+ expect(src).assertContain('example.com');
+
+ console.info('uitest: TestUiExample end');
+ done();
+ })
+ })
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/ohosTest/ets/test/List.test.ets b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/ohosTest/ets/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..f40533d1374f4046f8af1e7df6aa90157cb361d8
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/ohosTest/ets/test/List.test.ets
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import abilityTest from './Ability.test';
+
+export default function testsuite() {
+ abilityTest();
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/ohosTest/module.json5 b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/ohosTest/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..c3fd9dda3040d888d9d8b0b62bcb5d3b6fbeb614
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/ohosTest/module.json5
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "module": {
+ "name": "entry_test",
+ "type": "feature",
+ "deviceTypes": [
+ "default",
+ "tablet"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false
+ }
+}
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/test/List.test.ets b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..0ce5a4e436790deecb880ddf871876bd2a7f7b07
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/test/List.test.ets
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import localUnitTest from './LocalUnit.test';
+
+export default function testsuite() {
+ localUnitTest();
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/test/LocalUnit.test.ets b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/test/LocalUnit.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..b7b035e9b66997b8cac57382753074ff60c3f5ee
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry/src/test/LocalUnit.test.ets
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
+
+export default function localUnitTest() {
+ describe('localUnitTest', () => {
+ // Defines a test suite. Two parameters are supported: test suite name and test suite function.
+ beforeAll(() => {
+ // Presets an action, which is performed only once before all test cases of the test suite start.
+ // This API supports only one parameter: preset action function.
+ });
+ beforeEach(() => {
+ // Presets an action, which is performed before each unit test case starts.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: preset action function.
+ });
+ afterEach(() => {
+ // Presets a clear action, which is performed after each unit test case ends.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: clear action function.
+ });
+ afterAll(() => {
+ // Presets a clear action, which is performed after all test cases of the test suite end.
+ // This API supports only one parameter: clear action function.
+ });
+ it('assertContain', 0, () => {
+ // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
+ let a = 'abc';
+ let b = 'b';
+ // Defines a variety of assertion methods, which are used to declare expected boolean conditions.
+ expect(a).assertContain(b);
+ expect(a).assertEqual(a);
+ });
+ });
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/.gitignore b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..e2713a2779c5a3e0eb879efe6115455592caeea5
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/.gitignore
@@ -0,0 +1,6 @@
+/node_modules
+/oh_modules
+/.preview
+/build
+/.cxx
+/.test
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/build-profile.json5 b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..e7569e3056e27af38e9991b7ea73ec10f3ba8a05
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/build-profile.json5
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "apiType": "stageMode",
+ "buildOption": {
+ },
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": false,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ }
+ }
+ }
+ },
+ ],
+ "targets": [
+ {
+ "name": "default"
+ },
+ {
+ "name": "ohosTest",
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/hvigorfile.ts b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..98d52319cb1dee60511b5716dba03b76e68a6d8b
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/hvigorfile.ts
@@ -0,0 +1,21 @@
+/*
+* Copyright (c) 2025 Huawei Device Co., Ltd.
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+import { hapTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/obfuscation-rules.txt b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/obfuscation-rules.txt
new file mode 100644
index 0000000000000000000000000000000000000000..272efb6ca3f240859091bbbfc7c5802d52793b0b
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/obfuscation-rules.txt
@@ -0,0 +1,23 @@
+# Define project specific obfuscation rules here.
+# You can include the obfuscation configuration files in the current module's build-profile.json5.
+#
+# For more details, see
+# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
+
+# Obfuscation options:
+# -disable-obfuscation: disable all obfuscations
+# -enable-property-obfuscation: obfuscate the property names
+# -enable-toplevel-obfuscation: obfuscate the names in the global scope
+# -compact: remove unnecessary blank spaces and all line feeds
+# -remove-log: remove all console.* statements
+# -print-namecache: print the name cache that contains the mapping from the old names to new names
+# -apply-namecache: reuse the given cache file
+
+# Keep options:
+# -keep-property-name: specifies property names that you want to keep
+# -keep-global-name: specifies names that you want to keep in the global scope
+
+-enable-property-obfuscation
+-enable-toplevel-obfuscation
+-enable-filename-obfuscation
+-enable-export-obfuscation
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/oh-package.json5 b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..c4e8768835e5e869bbd19dfb80d2e323afaa6f2d
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/oh-package.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "name": "entry1",
+ "version": "1.0.0",
+ "description": "Please describe the basic information.",
+ "main": "",
+ "author": "",
+ "license": "",
+ "dependencies": {}
+}
+
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/main/ets/entry1ability/Entry1Ability.ets b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/main/ets/entry1ability/Entry1Ability.ets
new file mode 100644
index 0000000000000000000000000000000000000000..3377c9ffaec9f544b5a916055d599c55761194c0
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/main/ets/entry1ability/Entry1Ability.ets
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// [Start initialize_kernel_in_onCreate_and_pre_connect_to_homepage]
+import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { window } from '@kit.ArkUI';
+import { webview } from '@kit.ArkWeb';
+
+export default class Entry1Ability extends UIAbility {
+ onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) {
+ console.log('EntryAbility onCreate');
+ webview.WebviewController.initializeWebEngine();
+ // 预连接时,需要將'https://www.example.com'替换成真实要访问的网站地址。
+
+ webview.WebviewController.prepareForPageLoad(this.context.resourceManager.getStringSync($r('app.string.web_path_one')), true, 2);
+ AppStorage.setOrCreate('abilityWant', want);
+ console.log('EntryAbility onCreate done');
+ }
+
+ // [StartExclude initialize_kernel_in_onCreate_and_pre_connect_to_homepage]
+ onDestroy(): void {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
+ }
+
+ onWindowStageCreate(windowStage: window.WindowStage): void {
+ // Main window is created, set main page for this ability
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
+
+ windowStage.loadContent('pages/Index', (err) => {
+ if (err.code) {
+ hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
+ return;
+ }
+ hilog.info(0x0000, 'testTag', 'Succeeded in loading the content.');
+ });
+ }
+
+ onWindowStageDestroy(): void {
+ // Main window is destroyed, release UI related resources
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
+ }
+
+ onForeground(): void {
+ // Ability has brought to foreground
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
+ }
+
+ onBackground(): void {
+ // Ability has back to background
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
+ }
+ // [EndExclude initialize_kernel_in_onCreate_and_pre_connect_to_homepage]
+}
+// [End initialize_kernel_in_onCreate_and_pre_connect_to_homepage]
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/main/ets/pages/Index.ets b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/main/ets/pages/Index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..1a2fe4d9484543336d2e6c7bfce18192eb7278aa
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/main/ets/pages/Index.ets
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// [Start previously_connect_in_onAppear_to_pages_being_loaded]
+import { webview } from '@kit.ArkWeb';
+// [StartExclude previously_connect_in_onAppear_to_pages_being_loaded]
+function resourceToString(resource: Resource) {
+ return getContext().resourceManager.getStringSync(resource);
+}
+// [EndExclude previously_connect_in_onAppear_to_pages_being_loaded]
+
+@Entry
+@Component
+struct WebComponent {
+ webviewController: webview.WebviewController = new webview.WebviewController();
+
+ build() {
+ Column() {
+ Button('loadData')
+ .onClick(() => {
+ if (this.webviewController.accessBackward()) {
+ this.webviewController.backward();
+ }
+ })
+ Web({ src: $r('app.string.web_path_one'), controller: this.webviewController })
+ .onAppear(() => {
+ // 指定第二个参数为true,代表要进行预连接,如果为false该接口只会对网址进行dns预解析
+ // 第三个参数为要预连接socket的个数。最多允许6个。
+ webview.WebviewController.prepareForPageLoad(resourceToString($r('app.string.web_path_one')), true, 2);
+ })
+ }
+ }
+}
+//[End previously_connect_in_onAppear_to_pages_being_loaded]
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/main/module.json5 b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/main/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..5303c59d21b19cfd2c0a4299ec6ea72fede11eba
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/main/module.json5
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "module": {
+ "name": "entry1",
+ "type": "feature",
+ "description": "$string:module_desc",
+ "mainElement": "Entry1Ability",
+ "deviceTypes": [
+ "default",
+ "tablet"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false,
+ "pages": "$profile:main_pages",
+ "abilities": [
+ {
+ "name": "Entry1Ability",
+ "srcEntry": "./ets/entry1ability/Entry1Ability.ets",
+ "description": "$string:Entry1Ability_desc",
+ "icon": "$media:layered_image",
+ "label": "$string:Entry1Ability_label",
+ "startWindowIcon": "$media:startIcon",
+ "startWindowBackground": "$color:start_window_background",
+ "exported": true
+ }
+ ],
+ "requestPermissions": [
+ {
+ "name": "ohos.permission.INTERNET"
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/main/resources/base/element/color.json b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/main/resources/base/element/color.json
new file mode 100644
index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/main/resources/base/element/color.json
@@ -0,0 +1,8 @@
+{
+ "color": [
+ {
+ "name": "start_window_background",
+ "value": "#FFFFFF"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/main/resources/base/element/string.json b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..76a37f8e3d89782b8d1c1215279ecf96c008d58e
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/main/resources/base/element/string.json
@@ -0,0 +1,24 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "Entry1Ability_desc",
+ "value": "description"
+ },
+ {
+ "name": "Entry1Ability_label",
+ "value": "AcceleratePageAccess"
+ },
+ {
+ "name": "web_path",
+ "value": "https://www.example.com/"
+ },
+ {
+ "name": "web_path_one",
+ "value": "https://www.example.com"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/main/resources/base/media/background.png b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/main/resources/base/media/background.png
new file mode 100644
index 0000000000000000000000000000000000000000..f939c9fa8cc8914832e602198745f592a0dfa34d
Binary files /dev/null and b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/main/resources/base/media/background.png differ
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/main/resources/base/media/foreground.png b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/main/resources/base/media/foreground.png
new file mode 100644
index 0000000000000000000000000000000000000000..4483ddad1f079e1089d685bd204ee1cfe1d01902
Binary files /dev/null and b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/main/resources/base/media/foreground.png differ
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/main/resources/base/media/layered_image.json b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/main/resources/base/media/layered_image.json
new file mode 100644
index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/main/resources/base/media/layered_image.json
@@ -0,0 +1,7 @@
+{
+ "layered-image":
+ {
+ "background" : "$media:background",
+ "foreground" : "$media:foreground"
+ }
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/main/resources/base/media/startIcon.png b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/main/resources/base/media/startIcon.png
new file mode 100644
index 0000000000000000000000000000000000000000..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b
Binary files /dev/null and b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/main/resources/base/media/startIcon.png differ
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/main/resources/base/profile/main_pages.json b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/main/resources/base/profile/main_pages.json
new file mode 100644
index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/main/resources/base/profile/main_pages.json
@@ -0,0 +1,5 @@
+{
+ "src": [
+ "pages/Index"
+ ]
+}
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/mock/mock-config.json5 b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/mock/mock-config.json5
new file mode 100644
index 0000000000000000000000000000000000000000..b9a78e201535765168a92d3543c690273ecdc019
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/mock/mock-config.json5
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/ohosTest/ets/test/Ability.test.ets b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/ohosTest/ets/test/Ability.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..92f3212a1bf7d5c1936e398fec3c79bdf642d910
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/ohosTest/ets/test/Ability.test.ets
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
+import { abilityDelegatorRegistry, Driver, ON } from '@kit.TestKit';
+import { UIAbility, Want } from '@kit.AbilityKit';
+
+const delegator: abilityDelegatorRegistry.AbilityDelegator = abilityDelegatorRegistry.getAbilityDelegator();
+const bundleName = abilityDelegatorRegistry.getArguments().bundleName;
+export default function abilityTest() {
+ describe('ActsAbilityTest', () => {
+ // Defines a test suite. Two parameters are supported: test suite name and test suite function.
+ beforeAll(() => {
+ // Presets an action, which is performed only once before all test cases of the test suite start.
+ // This API supports only one parameter: preset action function.
+ })
+ beforeEach(() => {
+ // Presets an action, which is performed before each unit test case starts.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: preset action function.
+ })
+ afterEach(() => {
+ // Presets a clear action, which is performed after each unit test case ends.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: clear action function.
+ })
+ afterAll(() => {
+ // Presets a clear action, which is performed after all test cases of the test suite end.
+ // This API supports only one parameter: clear action function.
+ })
+
+ /*
+ * 打开应用
+ * 对即将要加载的页面进行预解析、预连接
+ */
+ it('TestUiExample', 0, async (done: Function) => {
+ console.info('uitest: TestUiExample begin');
+ const want: Want = {
+ bundleName: bundleName,
+ abilityName: 'Entry1Ability'
+ }
+ await delegator.startAbility(want);
+ const driver = Driver.create();
+ await driver.delayMs(1000);
+ const ability: UIAbility = await delegator.getCurrentTopAbility();
+ console.info('get top ability');
+ expect(ability.context.abilityInfo.name).assertEqual('Entry1Ability');
+ await driver.delayMs(3000);
+
+ const clickText = await driver.findComponent(ON.type('link'));
+ await clickText.click();
+ await driver.delayMs(5000);
+
+ const button = await driver.findComponent(ON.type('Button'));
+ await button.click();
+ await driver.delayMs(1000);
+
+ const web = await driver.findComponent(ON.type('Web'));
+ let src: string = await web.getText();
+ expect(src).assertContain('example.com');
+
+ console.info('uitest: TestUiExample end');
+ done();
+ })
+ })
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/ohosTest/ets/test/List.test.ets b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/ohosTest/ets/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..f40533d1374f4046f8af1e7df6aa90157cb361d8
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/ohosTest/ets/test/List.test.ets
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import abilityTest from './Ability.test';
+
+export default function testsuite() {
+ abilityTest();
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/ohosTest/module.json5 b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/ohosTest/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..a8392c11cf0dbecb4cdc78dc93d456a3a8e6ff41
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/ohosTest/module.json5
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "module": {
+ "name": "entry1_test",
+ "type": "feature",
+ "deviceTypes": [
+ "default",
+ "tablet"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false
+ }
+}
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/test/List.test.ets b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..0ce5a4e436790deecb880ddf871876bd2a7f7b07
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/test/List.test.ets
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import localUnitTest from './LocalUnit.test';
+
+export default function testsuite() {
+ localUnitTest();
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/test/LocalUnit.test.ets b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/test/LocalUnit.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..b7b035e9b66997b8cac57382753074ff60c3f5ee
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/test/LocalUnit.test.ets
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
+
+export default function localUnitTest() {
+ describe('localUnitTest', () => {
+ // Defines a test suite. Two parameters are supported: test suite name and test suite function.
+ beforeAll(() => {
+ // Presets an action, which is performed only once before all test cases of the test suite start.
+ // This API supports only one parameter: preset action function.
+ });
+ beforeEach(() => {
+ // Presets an action, which is performed before each unit test case starts.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: preset action function.
+ });
+ afterEach(() => {
+ // Presets a clear action, which is performed after each unit test case ends.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: clear action function.
+ });
+ afterAll(() => {
+ // Presets a clear action, which is performed after all test cases of the test suite end.
+ // This API supports only one parameter: clear action function.
+ });
+ it('assertContain', 0, () => {
+ // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
+ let a = 'abc';
+ let b = 'b';
+ // Defines a variety of assertion methods, which are used to declare expected boolean conditions.
+ expect(a).assertContain(b);
+ expect(a).assertEqual(a);
+ });
+ });
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/.gitignore b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..e2713a2779c5a3e0eb879efe6115455592caeea5
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/.gitignore
@@ -0,0 +1,6 @@
+/node_modules
+/oh_modules
+/.preview
+/build
+/.cxx
+/.test
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/build-profile.json5 b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..e7569e3056e27af38e9991b7ea73ec10f3ba8a05
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/build-profile.json5
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "apiType": "stageMode",
+ "buildOption": {
+ },
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": false,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ }
+ }
+ }
+ },
+ ],
+ "targets": [
+ {
+ "name": "default"
+ },
+ {
+ "name": "ohosTest",
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/hvigorfile.ts b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..98d52319cb1dee60511b5716dba03b76e68a6d8b
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/hvigorfile.ts
@@ -0,0 +1,21 @@
+/*
+* Copyright (c) 2025 Huawei Device Co., Ltd.
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+import { hapTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/obfuscation-rules.txt b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/obfuscation-rules.txt
new file mode 100644
index 0000000000000000000000000000000000000000..272efb6ca3f240859091bbbfc7c5802d52793b0b
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/obfuscation-rules.txt
@@ -0,0 +1,23 @@
+# Define project specific obfuscation rules here.
+# You can include the obfuscation configuration files in the current module's build-profile.json5.
+#
+# For more details, see
+# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
+
+# Obfuscation options:
+# -disable-obfuscation: disable all obfuscations
+# -enable-property-obfuscation: obfuscate the property names
+# -enable-toplevel-obfuscation: obfuscate the names in the global scope
+# -compact: remove unnecessary blank spaces and all line feeds
+# -remove-log: remove all console.* statements
+# -print-namecache: print the name cache that contains the mapping from the old names to new names
+# -apply-namecache: reuse the given cache file
+
+# Keep options:
+# -keep-property-name: specifies property names that you want to keep
+# -keep-global-name: specifies names that you want to keep in the global scope
+
+-enable-property-obfuscation
+-enable-toplevel-obfuscation
+-enable-filename-obfuscation
+-enable-export-obfuscation
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/oh-package.json5 b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..6f8ebfffe80a99a9743e76a638cdd63c2b6ec72f
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/oh-package.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "name": "entry2",
+ "version": "1.0.0",
+ "description": "Please describe the basic information.",
+ "main": "",
+ "author": "",
+ "license": "",
+ "dependencies": {}
+}
+
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/ets/entry2ability/Entry2Ability.ets b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/ets/entry2ability/Entry2Ability.ets
new file mode 100644
index 0000000000000000000000000000000000000000..dab8f3ea7260551b9dc6606eb397e396d241e701
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/ets/entry2ability/Entry2Ability.ets
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { window } from '@kit.ArkUI';
+
+export default class Entry2Ability extends UIAbility {
+ onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
+ }
+
+ onDestroy(): void {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
+ }
+
+ onWindowStageCreate(windowStage: window.WindowStage): void {
+ // Main window is created, set main page for this ability
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
+
+ windowStage.loadContent('pages/Index', (err) => {
+ if (err.code) {
+ hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
+ return;
+ }
+ hilog.info(0x0000, 'testTag', 'Succeeded in loading the content.');
+ });
+ }
+
+ onWindowStageDestroy(): void {
+ // Main window is destroyed, release UI related resources
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
+ }
+
+ onForeground(): void {
+ // Ability has brought to foreground
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
+ }
+
+ onBackground(): void {
+ // Ability has back to background
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
+ }
+}
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/ets/pages/Index.ets b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/ets/pages/Index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..e330ef4623eab184383297cf399532844448f58c
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/ets/pages/Index.ets
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { router } from '@kit.ArkUI';
+
+@Entry
+@Component
+struct Index {
+ build() {
+ Column({ space: 10 }) {
+ Button('Prefetching')
+ .onClick(() => {
+ router.pushUrl({ url: 'pages/Prefetching' });
+ })
+ Button('PrefetchingAPOSTRequest_one')
+ .onClick(() => {
+ router.pushUrl({ url: 'pages/PrefetchingAPOSTRequest_one' });
+ })
+ Button('PrefetchingAPOSTRequest_two')
+ .onClick(() => {
+ router.pushUrl({ url: 'pages/PrefetchingAPOSTRequest_two' });
+ })
+ Button('PrefetchingAPOSTRequest_three')
+ .onClick(() => {
+ router.pushUrl({ url: 'pages/PrefetchingAPOSTRequest_three' });
+ })
+ }.height('100%')
+ .width('100%')
+ }
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/ets/pages/Prefetching.ets b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/ets/pages/Prefetching.ets
new file mode 100644
index 0000000000000000000000000000000000000000..57d3b8e6e3b826c4740f5812e69e7138d2f89cd5
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/ets/pages/Prefetching.ets
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// [Start on_page_end_triggers_preload_of_next_page]
+import { webview } from '@kit.ArkWeb';
+// [StartExclude on_page_end_triggers_preload_of_next_page]
+function resourceToString(resource: Resource) {
+ return getContext().resourceManager.getStringSync(resource);
+}
+// [EndExclude on_page_end_triggers_preload_of_next_page]
+@Entry
+@Component
+struct WebComponent {
+ webviewController: webview.WebviewController = new webview.WebviewController();
+
+ build() {
+ Column() {
+ Web({ src: 'www.example.com', controller: this.webviewController })
+ .onPageEnd(() => {
+ // 预加载https://www.iana.org/help/example-domains。
+ this.webviewController.prefetchPage(resourceToString($r('app.string.domains_path')));
+ })
+ }
+ }
+}
+// [End on_page_end_triggers_preload_of_next_page]
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/ets/pages/PrefetchingAPOSTRequest_one.ets b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/ets/pages/PrefetchingAPOSTRequest_one.ets
new file mode 100644
index 0000000000000000000000000000000000000000..7440060a2fd78d48fb53e4ed48817f9a21855879
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/ets/pages/PrefetchingAPOSTRequest_one.ets
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//[Start prefetch_post_request_on_page_end_clear_cache]
+import { webview } from '@kit.ArkWeb';
+// [StartExclude prefetch_post_request_on_page_end_clear_cache]
+function resourceToString(resource: Resource) {
+ return getContext().resourceManager.getStringSync(resource);
+}
+// [EndExclude prefetch_post_request_on_page_end_clear_cache]
+@Entry
+@Component
+struct WebComponent {
+ webviewController: webview.WebviewController = new webview.WebviewController();
+
+ build() {
+ Column() {
+ Web({ src: $r('app.string.web_path'), controller: this.webviewController})
+ .onAppear(() => {
+ // 预获取时,需要將'https://www.example1.com/post?e=f&g=h'替换成真实要访问的网站地址。
+ webview.WebviewController.prefetchResource(
+ {url:resourceToString($r('app.string.post_path')),
+ method:'POST',
+ formData:'a=x&b=y',},
+ [{headerKey:'c',
+ headerValue:'z',},],
+ 'KeyX', 500);
+ })
+ .onPageEnd(() => {
+ // 清除后续不再使用的预获取资源缓存。
+ webview.WebviewController.clearPrefetchedResource(['KeyX',]);
+ })
+ }
+ }
+}
+//[End prefetch_post_request_on_page_end_clear_cache]
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/ets/pages/PrefetchingAPOSTRequest_three.ets b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/ets/pages/PrefetchingAPOSTRequest_three.ets
new file mode 100644
index 0000000000000000000000000000000000000000..b5b280f4b561f8638c51c5247704d1e179a6193f
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/ets/pages/PrefetchingAPOSTRequest_three.ets
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// [Start on_page_end_trigger_prefetch_post_request_access_page]
+import { webview } from '@kit.ArkWeb';
+// [StartExclude on_page_end_trigger_prefetch_post_request_access_page]
+function resourceToString(resource: Resource) {
+ return getContext().resourceManager.getStringSync(resource);
+}
+// [EndExclude on_page_end_trigger_prefetch_post_request_access_page]
+@Entry
+@Component
+struct WebComponent {
+ webviewController: webview.WebviewController = new webview.WebviewController();
+
+ build() {
+ Column() {
+ Web({ src: $r('app.string.web_path'), controller: this.webviewController})
+ .onPageEnd(() => {
+ // 预获取时,需要將'https://www.example1.com/post?e=f&g=h'替换成真实要访问的网站地址。
+ webview.WebviewController.prefetchResource(
+ {url:resourceToString($r('app.string.web_path')) + '/post?e=f&g=h',
+ method:'POST',
+ formData:'a=x&b=y',},
+ [{headerKey:'c',
+ headerValue:'z',},],
+ 'KeyX', 500);
+ })
+ }
+ }
+}
+//[End on_page_end_trigger_prefetch_post_request_access_page]
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/ets/pages/PrefetchingAPOSTRequest_two.ets b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/ets/pages/PrefetchingAPOSTRequest_two.ets
new file mode 100644
index 0000000000000000000000000000000000000000..bf09aea7ff25030baf584fd14c09ade89265977c
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/ets/pages/PrefetchingAPOSTRequest_two.ets
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start initialize_kernel_in_onCreate_and_pre_fetch_post_request]
+import { webview } from '@kit.ArkWeb';
+
+function resourceToString(resource: Resource) {
+ return getContext().resourceManager.getStringSync(resource);
+}
+
+@Entry
+@Component
+struct WebComponent {
+ webviewController: webview.WebviewController = new webview.WebviewController();
+
+ build() {
+ Column() {
+ Web({ src: $r('app.string.web_path'), controller: this.webviewController})
+ .onPageEnd(() => {
+ // 预获取时,需要將'https://www.example1.com/post?e=f&g=h'替换成真实要访问的网站地址。
+ webview.WebviewController.prefetchResource(
+ {url:resourceToString($r('app.string.post_path')),
+ method:'POST',
+ formData:'a=x&b=y',},
+ [{headerKey:'c',
+ headerValue:'z',},],
+ 'KeyX', 500);
+ })
+ }
+ }
+}
+// [End initialize_kernel_in_onCreate_and_pre_fetch_post_request]
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/module.json5 b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..7c87a975ff65dac27497e22e35d2efa530f8064f
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/module.json5
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "module": {
+ "name": "entry2",
+ "type": "feature",
+ "description": "$string:module_desc",
+ "mainElement": "Entry2Ability",
+ "deviceTypes": [
+ "default",
+ "tablet"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false,
+ "pages": "$profile:main_pages",
+ "abilities": [
+ {
+ "name": "Entry2Ability",
+ "srcEntry": "./ets/entry2ability/Entry2Ability.ets",
+ "description": "$string:Entry2Ability_desc",
+ "icon": "$media:layered_image",
+ "label": "$string:Entry2Ability_label",
+ "startWindowIcon": "$media:startIcon",
+ "startWindowBackground": "$color:start_window_background",
+ "exported": true
+ }
+ ],
+ "requestPermissions": [
+ {
+ "name": "ohos.permission.INTERNET"
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/resources/base/element/color.json b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/resources/base/element/color.json
new file mode 100644
index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/resources/base/element/color.json
@@ -0,0 +1,8 @@
+{
+ "color": [
+ {
+ "name": "start_window_background",
+ "value": "#FFFFFF"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/resources/base/element/string.json b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..b363550515903b8badcdcbf12d372a6791349190
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/resources/base/element/string.json
@@ -0,0 +1,28 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "Entry2Ability_desc",
+ "value": "description"
+ },
+ {
+ "name": "Entry2Ability_label",
+ "value": "AcceleratePageAccess"
+ },
+ {
+ "name": "web_path",
+ "value": "https://www.example.com/"
+ },
+ {
+ "name": "domains_path",
+ "value": "https://www.iana.org/help/example-domains"
+ },
+ {
+ "name": "post_path",
+ "value": "https://www.example1.com/post?e=f&g=h"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/resources/base/media/background.png b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/resources/base/media/background.png
new file mode 100644
index 0000000000000000000000000000000000000000..f939c9fa8cc8914832e602198745f592a0dfa34d
Binary files /dev/null and b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/resources/base/media/background.png differ
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/resources/base/media/foreground.png b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/resources/base/media/foreground.png
new file mode 100644
index 0000000000000000000000000000000000000000..4483ddad1f079e1089d685bd204ee1cfe1d01902
Binary files /dev/null and b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/resources/base/media/foreground.png differ
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/resources/base/media/layered_image.json b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/resources/base/media/layered_image.json
new file mode 100644
index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/resources/base/media/layered_image.json
@@ -0,0 +1,7 @@
+{
+ "layered-image":
+ {
+ "background" : "$media:background",
+ "foreground" : "$media:foreground"
+ }
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/resources/base/media/startIcon.png b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/resources/base/media/startIcon.png
new file mode 100644
index 0000000000000000000000000000000000000000..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b
Binary files /dev/null and b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/resources/base/media/startIcon.png differ
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/resources/base/profile/main_pages.json b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/resources/base/profile/main_pages.json
new file mode 100644
index 0000000000000000000000000000000000000000..1c4e7fcde829651559470084dc4c22f2f3c88b58
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/resources/base/profile/main_pages.json
@@ -0,0 +1,9 @@
+{
+ "src": [
+ "pages/Index",
+ "pages/Prefetching",
+ "pages/PrefetchingAPOSTRequest_one",
+ "pages/PrefetchingAPOSTRequest_two",
+ "pages/PrefetchingAPOSTRequest_three"
+ ]
+}
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/mock/mock-config.json5 b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/mock/mock-config.json5
new file mode 100644
index 0000000000000000000000000000000000000000..b9a78e201535765168a92d3543c690273ecdc019
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/mock/mock-config.json5
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/ohosTest/ets/test/Ability.test.ets b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/ohosTest/ets/test/Ability.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..4ad971c822e74f7fa1ac058671ad091bc5bf2497
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/ohosTest/ets/test/Ability.test.ets
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
+import { abilityDelegatorRegistry, Driver, ON } from '@kit.TestKit';
+import { UIAbility, Want } from '@kit.AbilityKit';
+
+const delegator: abilityDelegatorRegistry.AbilityDelegator = abilityDelegatorRegistry.getAbilityDelegator();
+const bundleName = abilityDelegatorRegistry.getArguments().bundleName;
+export default function abilityTest() {
+ describe('ActsAbilityTest', () => {
+ // Defines a test suite. Two parameters are supported: test suite name and test suite function.
+ beforeAll(() => {
+ // Presets an action, which is performed only once before all test cases of the test suite start.
+ // This API supports only one parameter: preset action function.
+ })
+ beforeEach(() => {
+ // Presets an action, which is performed before each unit test case starts.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: preset action function.
+ })
+ afterEach(() => {
+ // Presets a clear action, which is performed after each unit test case ends.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: clear action function.
+ })
+ afterAll(() => {
+ // Presets a clear action, which is performed after all test cases of the test suite end.
+ // This API supports only one parameter: clear action function.
+ })
+
+ /*
+ * 打开应用,点击 Prefetching 按钮
+ * 通过 prefetchPage 来预加载即将要加载页面
+ */
+ it('Prefetching', 0, async (done: Function) => {
+ console.info('uitest: Prefetching begin');
+ const want: Want = {
+ bundleName: bundleName,
+ abilityName: 'Entry2Ability'
+ };
+ await delegator.startAbility(want);
+ const driver = Driver.create();
+ await driver.delayMs(1000);
+ const ability: UIAbility = await delegator.getCurrentTopAbility();
+ console.info('get top ability');
+ expect(ability.context.abilityInfo.name).assertEqual('Entry2Ability');
+ await driver.delayMs(3000);
+
+ const button1 = await driver.findComponent(ON.text('Prefetching'));
+ await button1.click();
+ await driver.delayMs(1000);
+
+ const web = await driver.findComponent(ON.type('Web'));
+ let src: string = await web.getText();
+ expect(src).assertContain('example.com');
+
+ await driver.pressBack();
+ console.info('uitest: Prefetching end');
+ done();
+ });
+
+ /*
+ * 点击 PrefetchingAPOSTRequest_one 按钮
+ * 预获取将要加载页面中的post请求
+ * 在页面加载结束时,清除后续不再使用的预获取资源缓存
+ */
+ it('PrefetchingAPOSTRequest_one', 0, async (done: Function) => {
+ console.info('uitest: PrefetchingAPOSTRequest_one begin');
+ const driver = Driver.create();
+ await driver.delayMs(1000);
+
+ const button1 = await driver.findComponent(ON.text('PrefetchingAPOSTRequest_one'));
+ await button1.click();
+ await driver.delayMs(1000);
+
+ const web = await driver.findComponent(ON.type('Web'));
+ let src: string = await web.getText();
+ expect(src).assertContain('example.com');
+
+ await driver.pressBack();
+ console.info('uitest: PrefetchingAPOSTRequest_one end');
+ done();
+ });
+
+ /*
+ * 点击 PrefetchingAPOSTRequest_two 按钮
+ * 通过 prefetchResource 预获取即将要加载页面的post请求
+ */
+ it('PrefetchingAPOSTRequest_two', 0, async (done: Function) => {
+ console.info('uitest: PrefetchingAPOSTRequest_two begin');
+ const driver = Driver.create();
+ await driver.delayMs(1000);
+
+ const button1 = await driver.findComponent(ON.text('PrefetchingAPOSTRequest_two'));
+ await button1.click();
+ await driver.delayMs(1000);
+
+ const web = await driver.findComponent(ON.type('Web'));
+ let src: string = await web.getText();
+ expect(src).assertContain('example.com');
+
+ await driver.pressBack();
+ console.info('uitest: PrefetchingAPOSTRequest_two end');
+ done();
+ });
+
+ /*
+ * 点击 PrefetchingAPOSTRequest_three 按钮
+ * 在初始化内核后调用 prefetchResource 预获取将要加载页面中的post请求
+ */
+ it('PrefetchingAPOSTRequest_three', 0, async (done: Function) => {
+ console.info('uitest: PrefetchingAPOSTRequest_three begin');
+ const driver = Driver.create();
+ await driver.delayMs(1000);
+
+ const button1 = await driver.findComponent(ON.text('PrefetchingAPOSTRequest_three'));
+ await button1.click();
+ await driver.delayMs(1000);
+
+ const web = await driver.findComponent(ON.type('Web'));
+ let src: string = await web.getText();
+ expect(src).assertContain('example.com');
+
+ console.info('uitest: PrefetchingAPOSTRequest_three end');
+ done();
+ });
+ })
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/ohosTest/ets/test/List.test.ets b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/ohosTest/ets/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..f40533d1374f4046f8af1e7df6aa90157cb361d8
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/ohosTest/ets/test/List.test.ets
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import abilityTest from './Ability.test';
+
+export default function testsuite() {
+ abilityTest();
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/ohosTest/module.json5 b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/ohosTest/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..031b54bde39f1b8ca1884b863026dbc91fd5a75a
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/ohosTest/module.json5
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "module": {
+ "name": "entry2_test",
+ "type": "feature",
+ "deviceTypes": [
+ "default",
+ "tablet"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false
+ }
+}
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/test/List.test.ets b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..0ce5a4e436790deecb880ddf871876bd2a7f7b07
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/test/List.test.ets
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import localUnitTest from './LocalUnit.test';
+
+export default function testsuite() {
+ localUnitTest();
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/test/LocalUnit.test.ets b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/test/LocalUnit.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..b7b035e9b66997b8cac57382753074ff60c3f5ee
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/test/LocalUnit.test.ets
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
+
+export default function localUnitTest() {
+ describe('localUnitTest', () => {
+ // Defines a test suite. Two parameters are supported: test suite name and test suite function.
+ beforeAll(() => {
+ // Presets an action, which is performed only once before all test cases of the test suite start.
+ // This API supports only one parameter: preset action function.
+ });
+ beforeEach(() => {
+ // Presets an action, which is performed before each unit test case starts.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: preset action function.
+ });
+ afterEach(() => {
+ // Presets a clear action, which is performed after each unit test case ends.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: clear action function.
+ });
+ afterAll(() => {
+ // Presets a clear action, which is performed after all test cases of the test suite end.
+ // This API supports only one parameter: clear action function.
+ });
+ it('assertContain', 0, () => {
+ // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
+ let a = 'abc';
+ let b = 'b';
+ // Defines a variety of assertion methods, which are used to declare expected boolean conditions.
+ expect(a).assertContain(b);
+ expect(a).assertEqual(a);
+ });
+ });
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry3/.gitignore b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry3/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..e2713a2779c5a3e0eb879efe6115455592caeea5
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry3/.gitignore
@@ -0,0 +1,6 @@
+/node_modules
+/oh_modules
+/.preview
+/build
+/.cxx
+/.test
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry3/build-profile.json5 b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry3/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..e7569e3056e27af38e9991b7ea73ec10f3ba8a05
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry3/build-profile.json5
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "apiType": "stageMode",
+ "buildOption": {
+ },
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": false,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ }
+ }
+ }
+ },
+ ],
+ "targets": [
+ {
+ "name": "default"
+ },
+ {
+ "name": "ohosTest",
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry3/hvigorfile.ts b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry3/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..98d52319cb1dee60511b5716dba03b76e68a6d8b
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry3/hvigorfile.ts
@@ -0,0 +1,21 @@
+/*
+* Copyright (c) 2025 Huawei Device Co., Ltd.
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+import { hapTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry3/obfuscation-rules.txt b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry3/obfuscation-rules.txt
new file mode 100644
index 0000000000000000000000000000000000000000..272efb6ca3f240859091bbbfc7c5802d52793b0b
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry3/obfuscation-rules.txt
@@ -0,0 +1,23 @@
+# Define project specific obfuscation rules here.
+# You can include the obfuscation configuration files in the current module's build-profile.json5.
+#
+# For more details, see
+# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
+
+# Obfuscation options:
+# -disable-obfuscation: disable all obfuscations
+# -enable-property-obfuscation: obfuscate the property names
+# -enable-toplevel-obfuscation: obfuscate the names in the global scope
+# -compact: remove unnecessary blank spaces and all line feeds
+# -remove-log: remove all console.* statements
+# -print-namecache: print the name cache that contains the mapping from the old names to new names
+# -apply-namecache: reuse the given cache file
+
+# Keep options:
+# -keep-property-name: specifies property names that you want to keep
+# -keep-global-name: specifies names that you want to keep in the global scope
+
+-enable-property-obfuscation
+-enable-toplevel-obfuscation
+-enable-filename-obfuscation
+-enable-export-obfuscation
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry3/oh-package.json5 b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry3/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..655d244a4ec5c8e387d7ebfb66967132c8c952f6
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry3/oh-package.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "name": "entry3",
+ "version": "1.0.0",
+ "description": "Please describe the basic information.",
+ "main": "",
+ "author": "",
+ "license": "",
+ "dependencies": {}
+}
+
diff --git a/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry3/src/main/ets/entry3ability/Entry3Ability.ets b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry3/src/main/ets/entry3ability/Entry3Ability.ets
new file mode 100644
index 0000000000000000000000000000000000000000..407cf0869b146854e930d446181307ab937540b9
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry3/src/main/ets/entry3ability/Entry3Ability.ets
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start save_the_uiContext_to_localstorage_in_entry_ability]
+import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';
+import { window } from '@kit.ArkUI';
+// [StartExclude save_the_uiContext_to_localstorage_in_entry_ability]
+import { hilog } from '@kit.PerformanceAnalysisKit';
+// [EndExclude save_the_uiContext_to_localstorage_in_entry_ability]
+
+const localStorage: LocalStorage = new LocalStorage('uiContext');
+
+export default class Entry3Ability extends UIAbility {
+ public storage: LocalStorage = localStorage;
+ // [StartExclude save_the_uiContext_to_localstorage_in_entry_ability]
+ onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
+ }
+ // [EndExclude save_the_uiContext_to_localstorage_in_entry_ability]
+ // [StartExclude save_the_uiContext_to_localstorage_in_entry_ability]
+ onDestroy(): void {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
+ }
+ // [EndExclude save_the_uiContext_to_localstorage_in_entry_ability]
+ onWindowStageCreate(windowStage: window.WindowStage) {
+ windowStage.loadContent('pages/Index', this.storage, (err, data) => {
+ if (err.code) {
+ return;
+ }
+
+ this.storage.setOrCreate
|
|
+
+使用说明
+
+1. 通过拦截页面请求,在应用侧代码构建响应资源,实现自定义页面响应场景。
+
+### OnInterceptRequest_two
+
+#### 介绍
+
+1. 本示例主要介绍自定义页面请求响应,Web组件通过拦截页面请求,应用侧代码构建响应资源,在响应头中添加“ResponseDataID”字段,开启生成CodeCache的功能。
+
+#### 效果预览
+
+| 主页 |
+| ------------------------------------------------------------ |
+|
|
+
+使用说明
+
+1. 拦截页面请求,应用侧代码构建响应资源。
+
+### 工程目录
+
+```
+entry/src/main/
+|---ets
+|---|---entryability
+|---|---|---EntryAbility.ets
+|---|---pages
+|---|---|---Index.ets // 首页
+|---|---|---OnInterceptRequest_one
+|---|---|---OnInterceptRequest_two
+|---resources // 静态资源
+|---ohosTest
+|---|---ets
+|---|---|---tests
+|---|---|---|---Ability.test.ets // 自动化测试用例
+```
+
+
+### 相关权限
+
+[ohos.permission.INTERNET](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/security/AccessToken/permissions-for-all.md#ohospermissioninternet)
+
+### 依赖
+
+不涉及。
+
+### 约束与限制
+
+1. 本示例仅支持标准系统上运行,支持设备:华为手机。
+
+2. HarmonyOS系统:HarmonyOS 5.0.2 Release及以上。
+
+3. DevEco Studio版本:DevEco Studio 5.0.2 Release及以上。
+
+4. HarmonyOS SDK版本:HarmonyOS 5.0.2 Release及以上。
+
+### 下载
+
+如需单独下载本工程,执行如下命令:
+
+```
+git init
+git config core.sparsecheckout true
+echo ArkWeb/ManageWebPageLoadBrowse/CustomizePageResp > .git/info/sparse-checkout
+git remote add origin https://gitee.com/harmonyos_samples/guide-snippets.git
+git pull origin master
+```
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/CustomizePageResp/build-profile.json5 b/ArkWeb/ManageWebPageLoadBrowse/CustomizePageResp/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..9c284a291dc2cd15abf8025431e67aa253f01b81
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/CustomizePageResp/build-profile.json5
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "app": {
+ "signingConfigs": [],
+ "products": [
+ {
+ "name": "default",
+ "signingConfig": "default",
+ "compatibleSdkVersion": "5.0.2(14)",
+ "targetSdkVersion": "5.0.2(14)",
+ "runtimeOS": "HarmonyOS",
+ }
+ ],
+ "buildModeSet": [
+ {
+ "name": "debug",
+ },
+ {
+ "name": "release"
+ }
+ ]
+ },
+ "modules": [
+ {
+ "name": "entry",
+ "srcPath": "./entry",
+ "targets": [
+ {
+ "name": "default",
+ "applyToProducts": [
+ "default"
+ ]
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/CustomizePageResp/code-linter.json5 b/ArkWeb/ManageWebPageLoadBrowse/CustomizePageResp/code-linter.json5
new file mode 100644
index 0000000000000000000000000000000000000000..28586467ee7a761c737d8654a73aed6fddbc3c71
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/CustomizePageResp/code-linter.json5
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "files": [
+ "**/*.ets"
+ ],
+ "ignore": [
+ "**/src/ohosTest/**/*",
+ "**/src/test/**/*",
+ "**/src/mock/**/*",
+ "**/node_modules/**/*",
+ "**/oh_modules/**/*",
+ "**/build/**/*",
+ "**/.preview/**/*"
+ ],
+ "ruleSet": [
+ "plugin:@performance/recommended",
+ "plugin:@typescript-eslint/recommended"
+ ],
+ "rules": {
+ }
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/CustomizePageResp/entry/.gitignore b/ArkWeb/ManageWebPageLoadBrowse/CustomizePageResp/entry/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..e2713a2779c5a3e0eb879efe6115455592caeea5
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/CustomizePageResp/entry/.gitignore
@@ -0,0 +1,6 @@
+/node_modules
+/oh_modules
+/.preview
+/build
+/.cxx
+/.test
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/CustomizePageResp/entry/build-profile.json5 b/ArkWeb/ManageWebPageLoadBrowse/CustomizePageResp/entry/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..e7569e3056e27af38e9991b7ea73ec10f3ba8a05
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/CustomizePageResp/entry/build-profile.json5
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "apiType": "stageMode",
+ "buildOption": {
+ },
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": false,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ }
+ }
+ }
+ },
+ ],
+ "targets": [
+ {
+ "name": "default"
+ },
+ {
+ "name": "ohosTest",
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/CustomizePageResp/entry/hvigorfile.ts b/ArkWeb/ManageWebPageLoadBrowse/CustomizePageResp/entry/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..98d52319cb1dee60511b5716dba03b76e68a6d8b
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/CustomizePageResp/entry/hvigorfile.ts
@@ -0,0 +1,21 @@
+/*
+* Copyright (c) 2025 Huawei Device Co., Ltd.
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+import { hapTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/ArkWeb/ManageWebPageLoadBrowse/CustomizePageResp/entry/obfuscation-rules.txt b/ArkWeb/ManageWebPageLoadBrowse/CustomizePageResp/entry/obfuscation-rules.txt
new file mode 100644
index 0000000000000000000000000000000000000000..272efb6ca3f240859091bbbfc7c5802d52793b0b
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/CustomizePageResp/entry/obfuscation-rules.txt
@@ -0,0 +1,23 @@
+# Define project specific obfuscation rules here.
+# You can include the obfuscation configuration files in the current module's build-profile.json5.
+#
+# For more details, see
+# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
+
+# Obfuscation options:
+# -disable-obfuscation: disable all obfuscations
+# -enable-property-obfuscation: obfuscate the property names
+# -enable-toplevel-obfuscation: obfuscate the names in the global scope
+# -compact: remove unnecessary blank spaces and all line feeds
+# -remove-log: remove all console.* statements
+# -print-namecache: print the name cache that contains the mapping from the old names to new names
+# -apply-namecache: reuse the given cache file
+
+# Keep options:
+# -keep-property-name: specifies property names that you want to keep
+# -keep-global-name: specifies names that you want to keep in the global scope
+
+-enable-property-obfuscation
+-enable-toplevel-obfuscation
+-enable-filename-obfuscation
+-enable-export-obfuscation
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/CustomizePageResp/entry/oh-package.json5 b/ArkWeb/ManageWebPageLoadBrowse/CustomizePageResp/entry/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..c9cb6c8174858277c9b0d465a51547dcab16d5ff
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/CustomizePageResp/entry/oh-package.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "name": "entry",
+ "version": "1.0.0",
+ "description": "Please describe the basic information.",
+ "main": "",
+ "author": "",
+ "license": "",
+ "dependencies": {}
+}
+
diff --git a/ArkWeb/ManageWebPageLoadBrowse/CustomizePageResp/entry/src/main/ets/entryability/EntryAbility.ets b/ArkWeb/ManageWebPageLoadBrowse/CustomizePageResp/entry/src/main/ets/entryability/EntryAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..23a5f218909827e91bf6f66ce3d472c99df7c7c2
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/CustomizePageResp/entry/src/main/ets/entryability/EntryAbility.ets
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { window } from '@kit.ArkUI';
+
+export default class EntryAbility extends UIAbility {
+ onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
+ }
+
+ onDestroy(): void {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
+ }
+
+ onWindowStageCreate(windowStage: window.WindowStage): void {
+ // Main window is created, set main page for this ability
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
+
+ windowStage.loadContent('pages/Index', (err) => {
+ if (err.code) {
+ hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
+ return;
+ }
+ hilog.info(0x0000, 'testTag', 'Succeeded in loading the content.');
+ });
+ }
+
+ onWindowStageDestroy(): void {
+ // Main window is destroyed, release UI related resources
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
+ }
+
+ onForeground(): void {
+ // Ability has brought to foreground
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
+ }
+
+ onBackground(): void {
+ // Ability has back to background
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
+ }
+}
diff --git a/ArkWeb/ManageWebPageLoadBrowse/CustomizePageResp/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets b/ArkWeb/ManageWebPageLoadBrowse/CustomizePageResp/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..29feaca7669174be5c2b0e2366529ee94ab7e726
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/CustomizePageResp/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit';
+
+export default class EntryBackupAbility extends BackupExtensionAbility {
+ async onBackup() {
+ hilog.info(0x0000, 'testTag', 'onBackup ok');
+ }
+
+ async onRestore(bundleVersion: BundleVersion) {
+ hilog.info(0x0000, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion));
+ }
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/CustomizePageResp/entry/src/main/ets/pages/Index.ets b/ArkWeb/ManageWebPageLoadBrowse/CustomizePageResp/entry/src/main/ets/pages/Index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..a10f87a5bbe120280306cc35e5eb8de074c1fa27
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/CustomizePageResp/entry/src/main/ets/pages/Index.ets
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { router } from '@kit.ArkUI';
+
+@Entry
+@Component
+struct Index {
+ build() {
+ Column({ space: 10 }) {
+ Button('OnInterceptRequest_one')
+ .onClick(() => {
+ router.pushUrl({ url: 'pages/OnInterceptRequest_one' });
+ })
+ Button('OnInterceptRequest_two')
+ .onClick(() => {
+ router.pushUrl({ url: 'pages/OnInterceptRequest_two' });
+ })
+ }.height('100%')
+ .width('100%')
+ }
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/CustomizePageResp/entry/src/main/ets/pages/OnInterceptRequest_one.ets b/ArkWeb/ManageWebPageLoadBrowse/CustomizePageResp/entry/src/main/ets/pages/OnInterceptRequest_one.ets
new file mode 100644
index 0000000000000000000000000000000000000000..99b4325373d0f329d3c81f87eb45df1fbd3bdbf6
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/CustomizePageResp/entry/src/main/ets/pages/OnInterceptRequest_one.ets
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// [Start build_response_resources_to_implement_custom_page_response_scenarios]
+import { webview } from '@kit.ArkWeb';
+
+function resourceToString(resource: Resource) {
+ return getContext().resourceManager.getStringSync(resource);
+}
+
+@Entry
+@Component
+struct WebComponent {
+ controller: webview.WebviewController = new webview.WebviewController();
+ responseResource: WebResourceResponse = new WebResourceResponse();
+ // 开发者自定义响应数据
+ @State webData: string = '\n' +
+ '\n' +
+ '\n' +
+ '
|
|
+
+使用说明
+
+1. 点击loadUrl按钮加载指定的网页来变更此Web组件显示的网络页面。
+
+### LoadingLocalPages
+
+#### 介绍
+
+1. 本示例主要介绍使用Web组件加载页面,将本地页面文件放在应用的rawfile目录下,开发者可以在Web组件创建的时候指定默认加载的本地页面 ,并且加载完成后可通过调用loadUrl()接口变更当前Web组件的页面。
+
+#### 效果预览
+
+| 主页 | loadUrl |
+| ------------------------------------------------------------ | ------------------------------------------------------------ |
+|
|
|
+
+使用说明
+
+1. 点击loadUrl按钮来变更当前Web组件的页面。
+
+### LoadingHTMLRichTextData
+
+#### 介绍
+
+1. 本示例主要介绍使用Web组件加载页面,Web组件可以通过loadData()接口实现加载HTML格式的文本数据。
+
+#### 效果预览
+
+| 主页 | loadData |
+| ------------------------------------------------------------ | ------------------------------------------------------------ |
+|
|
|
+
+使用说明
+
+1. 点击loadUrl按钮加载HTML格式的文本数据。
+
+### LoadLocalPageFileInSandboxPath_one
+
+#### 介绍
+
+1. 本示例主要介绍使用Web组件加载页面,通过构造的单例对象GlobalContext获取沙箱路径,加载沙箱路径下的本地页面文件,需要开启应用中文件系统的访问fileAccess权限。
+
+#### 效果预览
+
+| 主页 |
+| ------------------------------------------------------------ |
+|
|
+
+使用说明
+
+1. 通过构造的单例对象GlobalContext获取沙箱路径,加载沙箱路径下的本地页面文件。
+
+### LoadLocalPageFileInSandboxPath_two
+
+#### 介绍
+
+1. 本示例主要介绍使用Web组件加载页面,Web组件可以通过data url方式直接加载HTML字符串。
+
+#### 效果预览
+
+| 主页 |
+| ------------------------------------------------------------ |
+|
|
+
+使用说明
+
+1. 通过data url方式直接加载HTML字符串。
+
+### 工程目录
+
+```
+entry/src/main/
+|---ets
+|---|---entryability
+|---|---|---EntryAbility.ets
+|---|---pages
+|---|---|---GlobalContext.ets
+|---|---|---Index.ets // 首页
+|---|---|---LoadingHTMLRichTextData.ets
+|---|---|---Loading LocalPages.ets
+|---|---|---Loading WebPages.ets
+|---|---|---Load LocalPageFileInSandboxPath_one.ets
+|---|---|---Load LocalPageFileInSandboxPath_two.ets
+|---resources // 静态资源
+|---ohosTest
+|---|---ets
+|---|---|---tests
+|---|---|---|---Ability.test.ets // 自动化测试用例
+```
+
+
+### 相关权限
+
+[ohos.permission.INTERNET](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/security/AccessToken/permissions-for-all.md#ohospermissioninternet)
+
+### 依赖
+
+不涉及。
+
+### 约束与限制
+
+1. 本示例仅支持标准系统上运行,支持设备:华为手机。
+
+2. HarmonyOS系统:HarmonyOS 5.0.2 Release及以上。
+
+3. DevEco Studio版本:DevEco Studio 5.0.2 Release及以上。
+
+4. HarmonyOS SDK版本:HarmonyOS 5.0.2 Release及以上。
+
+### 下载
+
+如需单独下载本工程,执行如下命令:
+
+```
+git init
+git config core.sparsecheckout true
+echo ArkWeb/ManageWebPageLoadBrowse/LoadPages > .git/info/sparse-checkout
+git remote add origin https://gitee.com/harmonyos_samples/guide-snippets.git
+git pull origin master
+```
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/LoadPages/build-profile.json5 b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..9c284a291dc2cd15abf8025431e67aa253f01b81
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/build-profile.json5
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "app": {
+ "signingConfigs": [],
+ "products": [
+ {
+ "name": "default",
+ "signingConfig": "default",
+ "compatibleSdkVersion": "5.0.2(14)",
+ "targetSdkVersion": "5.0.2(14)",
+ "runtimeOS": "HarmonyOS",
+ }
+ ],
+ "buildModeSet": [
+ {
+ "name": "debug",
+ },
+ {
+ "name": "release"
+ }
+ ]
+ },
+ "modules": [
+ {
+ "name": "entry",
+ "srcPath": "./entry",
+ "targets": [
+ {
+ "name": "default",
+ "applyToProducts": [
+ "default"
+ ]
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/LoadPages/code-linter.json5 b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/code-linter.json5
new file mode 100644
index 0000000000000000000000000000000000000000..28586467ee7a761c737d8654a73aed6fddbc3c71
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/code-linter.json5
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "files": [
+ "**/*.ets"
+ ],
+ "ignore": [
+ "**/src/ohosTest/**/*",
+ "**/src/test/**/*",
+ "**/src/mock/**/*",
+ "**/node_modules/**/*",
+ "**/oh_modules/**/*",
+ "**/build/**/*",
+ "**/.preview/**/*"
+ ],
+ "ruleSet": [
+ "plugin:@performance/recommended",
+ "plugin:@typescript-eslint/recommended"
+ ],
+ "rules": {
+ }
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/.gitignore b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..e2713a2779c5a3e0eb879efe6115455592caeea5
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/.gitignore
@@ -0,0 +1,6 @@
+/node_modules
+/oh_modules
+/.preview
+/build
+/.cxx
+/.test
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/build-profile.json5 b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..e7569e3056e27af38e9991b7ea73ec10f3ba8a05
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/build-profile.json5
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "apiType": "stageMode",
+ "buildOption": {
+ },
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": false,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ }
+ }
+ }
+ },
+ ],
+ "targets": [
+ {
+ "name": "default"
+ },
+ {
+ "name": "ohosTest",
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/hvigorfile.ts b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..e4f43d54667f8327c367c8096bd08bb8c75aff54
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/hvigorfile.ts
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { hapTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/obfuscation-rules.txt b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/obfuscation-rules.txt
new file mode 100644
index 0000000000000000000000000000000000000000..272efb6ca3f240859091bbbfc7c5802d52793b0b
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/obfuscation-rules.txt
@@ -0,0 +1,23 @@
+# Define project specific obfuscation rules here.
+# You can include the obfuscation configuration files in the current module's build-profile.json5.
+#
+# For more details, see
+# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
+
+# Obfuscation options:
+# -disable-obfuscation: disable all obfuscations
+# -enable-property-obfuscation: obfuscate the property names
+# -enable-toplevel-obfuscation: obfuscate the names in the global scope
+# -compact: remove unnecessary blank spaces and all line feeds
+# -remove-log: remove all console.* statements
+# -print-namecache: print the name cache that contains the mapping from the old names to new names
+# -apply-namecache: reuse the given cache file
+
+# Keep options:
+# -keep-property-name: specifies property names that you want to keep
+# -keep-global-name: specifies names that you want to keep in the global scope
+
+-enable-property-obfuscation
+-enable-toplevel-obfuscation
+-enable-filename-obfuscation
+-enable-export-obfuscation
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/oh-package.json5 b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..c9cb6c8174858277c9b0d465a51547dcab16d5ff
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/oh-package.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "name": "entry",
+ "version": "1.0.0",
+ "description": "Please describe the basic information.",
+ "main": "",
+ "author": "",
+ "license": "",
+ "dependencies": {}
+}
+
diff --git a/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/ets/entryability/EntryAbility.ets b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/ets/entryability/EntryAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..82e98bec44d83d2df03deb52508045cb06cc8604
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/ets/entryability/EntryAbility.ets
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { window } from '@kit.ArkUI';
+
+export default class EntryAbility extends UIAbility {
+ onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
+ }
+
+ onDestroy(): void {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
+ }
+
+ onWindowStageCreate(windowStage: window.WindowStage): void {
+ // Main window is created, set main page for this ability
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
+
+ windowStage.loadContent('pages/Index', (err) => {
+ if (err.code) {
+ hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
+ return;
+ }
+ hilog.info(0x0000, 'testTag', 'Succeeded in loading the content.');
+ });
+ }
+
+ onWindowStageDestroy(): void {
+ // Main window is destroyed, release UI related resources
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
+ }
+
+ onForeground(): void {
+ // Ability has brought to foreground
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
+ }
+
+ onBackground(): void {
+ // Ability has back to background
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
+ }
+}
diff --git a/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..29feaca7669174be5c2b0e2366529ee94ab7e726
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit';
+
+export default class EntryBackupAbility extends BackupExtensionAbility {
+ async onBackup() {
+ hilog.info(0x0000, 'testTag', 'onBackup ok');
+ }
+
+ async onRestore(bundleVersion: BundleVersion) {
+ hilog.info(0x0000, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion));
+ }
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/ets/pages/GlobalContext.ets b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/ets/pages/GlobalContext.ets
new file mode 100644
index 0000000000000000000000000000000000000000..4e388d7c0789a2fde9a1dbc86eb58c8c77b8b856
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/ets/pages/GlobalContext.ets
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start after_load_complete_call_to_change_page]
+export class GlobalContext {
+ private constructor() {}
+ private static instance: GlobalContext;
+ private _objects = new Mapsource'; + + build() { + Column() { + // 组件创建时,加载htmlStr + Web({ src: this.htmlStr, controller: this.controller }); + } + } +} +// [End web_components_load_html_strings_by_data_url] diff --git a/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/ets/pages/LoadingHTMLRichTextData.ets b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/ets/pages/LoadingHTMLRichTextData.ets new file mode 100644 index 0000000000000000000000000000000000000000..cc56f8160ac8640379d79cd3752462ccd690cc69 --- /dev/null +++ b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/ets/pages/LoadingHTMLRichTextData.ets @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// [Start devs_load_page_fragments_for_quick_loading] +import { webview } from '@kit.ArkWeb'; +import { BusinessError } from '@kit.BasicServicesKit'; + +@Entry +@Component +struct WebComponent { + controller: webview.WebviewController = new webview.WebviewController(); + + build() { + Column() { + Button('loadData') + .onClick(() => { + try { + // 点击按钮时,通过loadData,加载HTML格式的文本数据 + this.controller.loadData( + 'Source:
source', + 'text/html', + 'UTF-8' + ); + } catch (error) { + console.error(`ErrorCode: ${(error as BusinessError).code}, Message: ${(error as BusinessError).message}`); + } + }) + // 组件创建时,加载www.example.com + Web({ src: 'www.example.com', controller: this.controller }) + } + } +} +// [End devs_load_page_fragments_for_quick_loading] \ No newline at end of file diff --git a/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/ets/pages/LoadingLocalPages.ets b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/ets/pages/LoadingLocalPages.ets new file mode 100644 index 0000000000000000000000000000000000000000..781bbe446f028de2b05bfcac1510cac7dea85ad5 --- /dev/null +++ b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/ets/pages/LoadingLocalPages.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +// [Start after_load_complete_call_to_change_page] +import { webview } from '@kit.ArkWeb'; +import { BusinessError } from '@kit.BasicServicesKit'; + +@Entry +@Component +struct WebComponent { + controller: webview.WebviewController = new webview.WebviewController(); + + build() { + Column() { + Button('loadUrl') + .onClick(() => { + try { + // 点击按钮时,通过loadUrl,跳转到local1.html + this.controller.loadUrl($rawfile('local1.html')); + } catch (error) { + console.error(`ErrorCode: ${(error as BusinessError).code}, Message: ${(error as BusinessError).message}`); + } + }) + // 组件创建时,通过$rawfile加载本地文件local.html + Web({ src: $rawfile('local.html'), controller: this.controller }); + } + } +} +// [End after_load_complete_call_to_change_page] \ No newline at end of file diff --git a/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/ets/pages/LoadingWebPages.ets b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/ets/pages/LoadingWebPages.ets new file mode 100644 index 0000000000000000000000000000000000000000..e1bb08055573f295a89c60d8119d3fc2df4bd2a2 --- /dev/null +++ b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/ets/pages/LoadingWebPages.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// [Start use_load_interface_to_show_web_changes] +import { webview } from '@kit.ArkWeb'; +import { BusinessError } from '@kit.BasicServicesKit'; + +@Entry +@Component +struct WebComponent { + controller: webview.WebviewController = new webview.WebviewController(); + + build() { + Column() { + Button('loadUrl') + .onClick(() => { + try { + // 点击按钮时,通过loadUrl,跳转到www.example1.com + this.controller.loadUrl('www.example1.com'); + } catch (error) { + console.error(`ErrorCode: ${(error as BusinessError).code}, Message: ${(error as BusinessError).message}`); + } + }) + // 组件创建时,加载www.example.com + Web({ src: 'www.example.com', controller: this.controller }); + } + } +} +// [End use_load_interface_to_show_web_changes] \ No newline at end of file diff --git a/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/module.json5 b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..ee18f9ce4fbbaa1861e1de23ff3e4846c93efc87 --- /dev/null +++ b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/module.json5 @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +{ + "module": { + "name": "entry", + "type": "entry", + "description": "$string:module_desc", + "mainElement": "EntryAbility", + "deviceTypes": [ + "default", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "EntryAbility", + "srcEntry": "./ets/entryability/EntryAbility.ets", + "description": "$string:EntryAbility_desc", + "icon": "$media:layered_image", + "label": "$string:EntryAbility_label", + "startWindowIcon": "$media:startIcon", + "startWindowBackground": "$color:start_window_background", + "exported": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ], + "extensionAbilities": [ + { + "name": "EntryBackupAbility", + "srcEntry": "./ets/entrybackupability/EntryBackupAbility.ets", + "type": "backup", + "exported": false, + "metadata": [ + { + "name": "ohos.extension.backup", + "resource": "$profile:backup_config" + } + ] + } + ], + "requestPermissions":[ + { + "name": "ohos.permission.INTERNET" + } + ] + } +} \ No newline at end of file diff --git a/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/resources/base/element/color.json b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02 --- /dev/null +++ b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/resources/base/element/string.json b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..13ba44d53db0cce9e6b90d39a451fb166108470b --- /dev/null +++ b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "LoadPages" + } + ] +} \ No newline at end of file diff --git a/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/resources/base/media/background.png b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/resources/base/media/background.png new file mode 100644 index 0000000000000000000000000000000000000000..f939c9fa8cc8914832e602198745f592a0dfa34d Binary files /dev/null and b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/resources/base/media/background.png differ diff --git a/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/resources/base/media/foreground.png b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/resources/base/media/foreground.png new file mode 100644 index 0000000000000000000000000000000000000000..4483ddad1f079e1089d685bd204ee1cfe1d01902 Binary files /dev/null and b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/resources/base/media/foreground.png differ diff --git a/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/resources/base/media/layered_image.json b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/resources/base/media/layered_image.json new file mode 100644 index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a --- /dev/null +++ b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/resources/base/media/layered_image.json @@ -0,0 +1,7 @@ +{ + "layered-image": + { + "background" : "$media:background", + "foreground" : "$media:foreground" + } +} \ No newline at end of file diff --git a/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/resources/base/media/startIcon.png b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/resources/base/media/startIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b Binary files /dev/null and b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/resources/base/media/startIcon.png differ diff --git a/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/resources/base/profile/backup_config.json b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/resources/base/profile/backup_config.json new file mode 100644 index 0000000000000000000000000000000000000000..78f40ae7c494d71e2482278f359ec790ca73471a --- /dev/null +++ b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/resources/base/profile/backup_config.json @@ -0,0 +1,3 @@ +{ + "allowToBackupRestore": true +} \ No newline at end of file diff --git a/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/resources/base/profile/main_pages.json b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..55043dfca0e13cb4390abc45b022b0aa9ec038c9 --- /dev/null +++ b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,10 @@ +{ + "src": [ + "pages/Index", + "pages/LoadingWebPages", + "pages/LoadingLocalPages", + "pages/LoadingHTMLRichTextData", + "pages/LoadLocalPageFileInSandboxPath_one", + "pages/LoadLocalPageFileInSandboxPath_two" + ] +} diff --git a/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/resources/en_US/element/string.json b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..13ba44d53db0cce9e6b90d39a451fb166108470b --- /dev/null +++ b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/resources/en_US/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "LoadPages" + } + ] +} \ No newline at end of file diff --git a/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/resources/rawfile/local.html b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/resources/rawfile/local.html new file mode 100644 index 0000000000000000000000000000000000000000..4e7956396344e0db753afb9431de6cfa7b0a1e07 --- /dev/null +++ b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/resources/rawfile/local.html @@ -0,0 +1,21 @@ + + + + + +
Hello World
+ + diff --git a/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/resources/rawfile/local1.html b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/resources/rawfile/local1.html new file mode 100644 index 0000000000000000000000000000000000000000..5b3b0b03bbf5da5ac6fc1287737a776b2a9e3d4d --- /dev/null +++ b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/resources/rawfile/local1.html @@ -0,0 +1,21 @@ + + + + + +This is local1 page
+ + diff --git a/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/resources/zh_CN/element/string.json b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..becedf26056eeec62877304965a627eece9f3da3 --- /dev/null +++ b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "模块描述" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "LoadPages" + } + ] +} \ No newline at end of file diff --git a/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/mock/mock-config.json5 b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/mock/mock-config.json5 new file mode 100644 index 0000000000000000000000000000000000000000..b9a78e201535765168a92d3543c690273ecdc019 --- /dev/null +++ b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/mock/mock-config.json5 @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +{ +} \ No newline at end of file diff --git a/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/ohosTest/ets/test/Ability.test.ets b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/ohosTest/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..4843837034de0f1083ef3ff7cb78ca3d120146b0 --- /dev/null +++ b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/ohosTest/ets/test/Ability.test.ets @@ -0,0 +1,175 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; +import { abilityDelegatorRegistry, Driver, ON } from '@kit.TestKit'; +import { UIAbility, Want } from '@kit.AbilityKit'; + +const delegator: abilityDelegatorRegistry.AbilityDelegator = abilityDelegatorRegistry.getAbilityDelegator(); +const bundleName = abilityDelegatorRegistry.getArguments().bundleName; +export default function abilityTest() { + describe('ActsAbilityTest', () => { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(() => { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. + }) + beforeEach(() => { + // Presets an action, which is performed before each unit test case starts. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: preset action function. + }) + afterEach(() => { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }) + afterAll(() => { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }) + + /* + * 打开应用,点击 LoadingWebPages 按钮 + * 在默认页面加载完成后,调用 loadUrl 接口加载指定的网页 + */ + it('LoadingWebPages', 0, async (done: Function) => { + console.info('uitest: LoadingWebPages begin'); + const want: Want = { + bundleName: bundleName, + abilityName: 'EntryAbility' + }; + await delegator.startAbility(want); + const driver = Driver.create(); + await driver.delayMs(1000); + const ability: UIAbility = await delegator.getCurrentTopAbility(); + console.info('get top ability'); + expect(ability.context.abilityInfo.name).assertEqual('EntryAbility'); + await driver.delayMs(4000); + + const button1 = await driver.findComponent(ON.text('LoadingWebPages')); + await button1.click(); + await driver.delayMs(1000); + + const button2 = await driver.findComponent(ON.type('Button')); + await button2.click(); + await driver.delayMs(1000); + + const type = await driver.findComponent(ON.type('Web')); + let src: string = await type.getText(); + expect(src).assertContain('example.com'); + + await driver.pressBack(); + console.info('uitest: LoadingWebPages end'); + done(); + }); + + /* + * 打开应用,点击 LoadingLocalPages 按钮 + * 默认页面加载完成后可通过调用 loadUrl 接口变更当前Web组件的页面 + */ + it('LoadingLocalPages', 0, async (done: Function) => { + console.info('uitest: LoadingLocalPages begin'); + const driver = Driver.create(); + await driver.delayMs(1000); + + const button1 = await driver.findComponent(ON.text('LoadingLocalPages')); + await button1.click(); + await driver.delayMs(1000); + + const button = await driver.findComponent(ON.type('Button')); + await button.click(); + await driver.delayMs(1000); + + const type = await driver.findComponent(ON.type('Web')); + let src: string = await type.getText(); + expect(src).assertContain('local.html'); + + await driver.pressBack(); + console.info('uitest: LoadingLocalPages end'); + done(); + }); + + /* + * 打开应用,点击 LoadingHTMLRichTextData 按钮 + * 通过 loadData 接口实现加载HTML格式的文本数据 + */ + it('LoadingHTMLRichTextData', 0, async (done: Function) => { + console.info('uitest: LoadingHTMLRichTextData begin'); + const driver = Driver.create(); + await driver.delayMs(1000); + + const button1 = await driver.findComponent(ON.text('LoadingHTMLRichTextData')); + await button1.click(); + await driver.delayMs(1000); + + const button = await driver.findComponent(ON.type('Button')); + await button.click(); + await driver.delayMs(1000); + + const web = await driver.findComponent(ON.type('Web')); + let src: string = await web.getText(); + expect(src).assertContain('example.com'); + + await driver.pressBack(); + console.info('uitest: LoadingHTMLRichTextData end'); + done(); + }); + + /* + * 打开应用,点击 LoadLocalPageFileInSandboxPath_one 按钮 + * 加载沙箱路径下的本地页面文件,需要开启应用中文件系统的访问fileAccess权限 + */ + it('LoadLocalPageFileInSandboxPath_one', 0, async (done: Function) => { + console.info('uitest: LoadLocalPageFileInSandboxPath_one begin'); + const driver = Driver.create(); + await driver.delayMs(1000); + + const button1 = await driver.findComponent(ON.text('LoadLocalPageFileInSandboxPath_one')); + await button1.click(); + await driver.delayMs(1000); + + const type1 = await driver.findComponent(ON.type('Text')); + let text1: string = await type1.getText(); + expect(text1).assertContain('loading success'); + + await driver.pressBack(); + console.info('uitest: LoadLocalPageFileInSandboxPath_one end'); + done(); + }); + + /* + * 打开应用,点击 LoadLocalPageFileInSandboxPath_two 按钮 + * 通过data url方式直接加载HTML字符串 + */ + it('LoadLocalPageFileInSandboxPath_two', 0, async (done: Function) => { + console.info('uitest: LoadLocalPageFileInSandboxPath_two begin'); + const driver = Driver.create(); + await driver.delayMs(1000); + + const button1 = await driver.findComponent(ON.text('LoadLocalPageFileInSandboxPath_two')); + await button1.click(); + await driver.delayMs(1000); + + const web1 = await driver.findComponent(ON.type('Web')); + let src: string = await web1.getText(); + expect(src).assertContain('Source:'); + + await driver.pressBack(); + console.info('uitest: LoadLocalPageFileInSandboxPath_two end'); + done(); + }); + }) +} \ No newline at end of file diff --git a/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/ohosTest/ets/test/List.test.ets b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/ohosTest/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..f40533d1374f4046f8af1e7df6aa90157cb361d8 --- /dev/null +++ b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/ohosTest/ets/test/List.test.ets @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import abilityTest from './Ability.test'; + +export default function testsuite() { + abilityTest(); +} \ No newline at end of file diff --git a/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/ohosTest/module.json5 b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/ohosTest/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..c3fd9dda3040d888d9d8b0b62bcb5d3b6fbeb614 --- /dev/null +++ b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/ohosTest/module.json5 @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +{ + "module": { + "name": "entry_test", + "type": "feature", + "deviceTypes": [ + "default", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false + } +} diff --git a/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/test/List.test.ets b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..0ce5a4e436790deecb880ddf871876bd2a7f7b07 --- /dev/null +++ b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/test/List.test.ets @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import localUnitTest from './LocalUnit.test'; + +export default function testsuite() { + localUnitTest(); +} \ No newline at end of file diff --git a/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/test/LocalUnit.test.ets b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/test/LocalUnit.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..b7b035e9b66997b8cac57382753074ff60c3f5ee --- /dev/null +++ b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/test/LocalUnit.test.ets @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; + +export default function localUnitTest() { + describe('localUnitTest', () => { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(() => { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. + }); + beforeEach(() => { + // Presets an action, which is performed before each unit test case starts. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: preset action function. + }); + afterEach(() => { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }); + afterAll(() => { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }); + it('assertContain', 0, () => { + // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. + let a = 'abc'; + let b = 'b'; + // Defines a variety of assertion methods, which are used to declare expected boolean conditions. + expect(a).assertContain(b); + expect(a).assertEqual(a); + }); + }); +} \ No newline at end of file diff --git a/ArkWeb/ManageWebPageLoadBrowse/LoadPages/hvigor/hvigor-config.json5 b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/hvigor/hvigor-config.json5 new file mode 100644 index 0000000000000000000000000000000000000000..43beb743cbd25c3507b1cf8a744bf8197b3bf2fb --- /dev/null +++ b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/hvigor/hvigor-config.json5 @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +{ + "modelVersion": "5.0.0", + "dependencies": { + }, + "execution": { + // "analyze": "normal", /* Define the build analyze mode. Value: [ "normal" | "advanced" | false ]. Default: "normal" */ + // "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */ + // "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */ + // "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */ + // "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */ + }, + "logging": { + // "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */ + }, + "debugging": { + // "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */ + }, + "nodeOptions": { + // "maxOldSpaceSize": 8192 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process. Default: 8192*/ + // "exposeGC": true /* Enable to trigger garbage collection explicitly. Default: true*/ + } +} diff --git a/ArkWeb/ManageWebPageLoadBrowse/LoadPages/hvigorfile.ts b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..2a5e543f190732c159beb574dfc9fa37bc94e156 --- /dev/null +++ b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/hvigorfile.ts @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { appTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/ArkWeb/ManageWebPageLoadBrowse/LoadPages/oh-package.json5 b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..93f097993a458e967d6d5239ea0580e79b5d6998 --- /dev/null +++ b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/oh-package.json5 @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +{ + "modelVersion": "5.0.0", + "description": "Please describe the basic information.", + "dependencies": { + }, + "devDependencies": { + "@ohos/hypium": "1.0.19", + "@ohos/hamock": "1.0.0" + } +} diff --git a/ArkWeb/ManageWebPageLoadBrowse/LoadPages/ohosTest.md b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/ohosTest.md new file mode 100644 index 0000000000000000000000000000000000000000..af2960f92e5798733ea4e4ba0974f6c1d3238b11 --- /dev/null +++ b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/ohosTest.md @@ -0,0 +1,30 @@ +#### LoadingWebPages + +| 测试功能 | 预置条件 | 输入 | 预期输出 | 是否自动 | 测试结果 | +| ------------------- | ------------ | ----------------------------- | -------------- | -------- | -------- | +| 使用Web组件加载页面 | 设备运转正常 | 应用启动成功,点击loadUrl按钮 | 加载指定的网页 | Yes | Pass | + +#### LoadingLocalPages + +| 测试功能 | 预置条件 | 输入 | 预期输出 | 是否自动 | 测试结果 | +| ------------------- | ------------ | ----------------------------- | --------------------- | -------- | -------- | +| 使用Web组件加载页面 | 设备运转正常 | 应用启动成功,点击loadUrl按钮 | 变更当前Web组件的页面 | Yes | Pass | + +#### LoadingHTMLRichTextData + +| 测试功能 | 预置条件 | 输入 | 预期输出 | 是否自动 | 测试结果 | +| ------------------- | ------------ | ----------------------------- | ---------------------- | -------- | -------- | +| 使用Web组件加载页面 | 设备运转正常 | 应用启动成功,点击loadUrl按钮 | 加载HTML格式的文本数据 | Yes | Pass | + +#### LoadLocalPageFileInSandboxPath_one + +| 测试功能 | 预置条件 | 输入 | 预期输出 | 是否自动 | 测试结果 | +| ------------------- | ------------ | ------------ | ---------------------------------------- | -------- | -------- | +| 使用Web组件加载页面 | 设备运转正常 | 应用启动成功 | 获取沙箱路径加载沙箱路径下的本地页面文件 | Yes | Pass | + +#### LoadLocalPageFileInSandboxPath_two + +| 测试功能 | 预置条件 | 输入 | 预期输出 | 是否自动 | 测试结果 | +| ------------------- | ------------ | ------------ | ---------------------------------- | -------- | -------- | +| 使用Web组件加载页面 | 设备运转正常 | 应用启动成功 | 通过data url方式直接加载HTML字符串 | Yes | Pass | + diff --git a/ArkWeb/ManageWebPageLoadBrowse/LoadPages/screenshots/LoadLocalPageFileInSandboxPath_one.png b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/screenshots/LoadLocalPageFileInSandboxPath_one.png new file mode 100644 index 0000000000000000000000000000000000000000..a7c815eb6349f7cf7eb93464d57f666fb7d21fc7 Binary files /dev/null and b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/screenshots/LoadLocalPageFileInSandboxPath_one.png differ diff --git a/ArkWeb/ManageWebPageLoadBrowse/LoadPages/screenshots/LoadLocalPageFileInSandboxPath_two.png b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/screenshots/LoadLocalPageFileInSandboxPath_two.png new file mode 100644 index 0000000000000000000000000000000000000000..03d9599d1612eb550fa3edb973024838fd7f63f9 Binary files /dev/null and b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/screenshots/LoadLocalPageFileInSandboxPath_two.png differ diff --git a/ArkWeb/ManageWebPageLoadBrowse/LoadPages/screenshots/LoadingHTMLRichTextData_1.png b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/screenshots/LoadingHTMLRichTextData_1.png new file mode 100644 index 0000000000000000000000000000000000000000..dfc5745ac65d84f78a68c07b30a69fc42ef6200f Binary files /dev/null and b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/screenshots/LoadingHTMLRichTextData_1.png differ diff --git a/ArkWeb/ManageWebPageLoadBrowse/LoadPages/screenshots/LoadingHTMLRichTextData_2.png b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/screenshots/LoadingHTMLRichTextData_2.png new file mode 100644 index 0000000000000000000000000000000000000000..89b1161c6af2b78263d8d73d873b003671c4662c Binary files /dev/null and b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/screenshots/LoadingHTMLRichTextData_2.png differ diff --git a/ArkWeb/ManageWebPageLoadBrowse/LoadPages/screenshots/LoadingLocalPages_1.png b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/screenshots/LoadingLocalPages_1.png new file mode 100644 index 0000000000000000000000000000000000000000..385ef0d06d87a17b50786e29cee0465b25a882e3 Binary files /dev/null and b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/screenshots/LoadingLocalPages_1.png differ diff --git a/ArkWeb/ManageWebPageLoadBrowse/LoadPages/screenshots/LoadingLocalPages_2.png b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/screenshots/LoadingLocalPages_2.png new file mode 100644 index 0000000000000000000000000000000000000000..b7ec203d712bd013a4bccbb66b5a62916a70b147 Binary files /dev/null and b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/screenshots/LoadingLocalPages_2.png differ diff --git a/ArkWeb/ManageWebPageLoadBrowse/LoadPages/screenshots/LoadingWebPages_1.png b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/screenshots/LoadingWebPages_1.png new file mode 100644 index 0000000000000000000000000000000000000000..eb39d90e0f1758ba3640bd6021f031f7d99c885c Binary files /dev/null and b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/screenshots/LoadingWebPages_1.png differ diff --git a/ArkWeb/ManageWebPageLoadBrowse/LoadPages/screenshots/LoadingWebPages_2.png b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/screenshots/LoadingWebPages_2.png new file mode 100644 index 0000000000000000000000000000000000000000..8794cba878eb7e77ac5fcb6757ba2383fae77e5d Binary files /dev/null and b/ArkWeb/ManageWebPageLoadBrowse/LoadPages/screenshots/LoadingWebPages_2.png differ diff --git a/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/.gitignore b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..d2ff20141ceed86d87c0ea5d99481973005bab2b --- /dev/null +++ b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/.gitignore @@ -0,0 +1,12 @@ +/node_modules +/oh_modules +/local.properties +/.idea +**/build +/.hvigor +.cxx +/.clangd +/.clang-format +/.clang-tidy +**/.test +/.appanalyzer \ No newline at end of file diff --git a/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/AppScope/app.json5 b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/AppScope/app.json5 new file mode 100644 index 0000000000000000000000000000000000000000..829e8ba122dafa9aad9d543ebd9a3a6e1fb0dd10 --- /dev/null +++ b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/AppScope/app.json5 @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +{ + "app": { + "bundleName": "com.samples.managepageredirectnav", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name" + } +} diff --git a/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/AppScope/resources/base/element/string.json b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f2843105d1f0874209a5c4a51a1d2c67d51e296c --- /dev/null +++ b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ManagePageRedirectNav" + } + ] +} diff --git a/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/AppScope/resources/base/media/app_icon.png b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..a39445dc87828b76fed6d2ec470dd455c45319e3 Binary files /dev/null and b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/AppScope/resources/base/media/app_icon.png differ diff --git a/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/README.md b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/README.md new file mode 100644 index 0000000000000000000000000000000000000000..8bd27c6b95d99602af40bdb73f2f9cce4de2e816 --- /dev/null +++ b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/README.md @@ -0,0 +1,104 @@ +# 管理页面跳转及浏览记录导航 + +### 介绍 + +1. 本工程主要实现了对以下指南文档中 https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/web/web-redirection-and-browsing-history-mgmt.md 示例代码片段的工程化,主要目标是实现指南中示例代码需要与sample工程文件同源。 + +### HistoryNavigati + +#### 介绍 + +1. 本示例主要介绍管理页面跳转及浏览记录导航,如果存在历史记录,accessBackward()接口会返回true。同样可以使用accessForward()接口检查是否存在前进的历史记录。 + +#### 效果预览 + +| 主页 | More information... | +| ------------------------------------------------------------ | ------------------------------------------------------------ | +|
|
|
+
+使用说明
+
+1. 点击More information...链接到达下一界面,来生成历史记录。
+1. 点击loadData按钮来触发前端页面的后退操作。
+
+### PageRedirection
+
+#### 介绍
+
+1. 本示例主要介绍页面跳转管理和浏览记录导航。当用户点击网页链接需要跳转到应用内其它页面时,可以通过使用Web组件的onLoadIntercept()接口来实现。
+
+#### 效果预览
+
+| 主页 | 跳转 |
+| ------------------------------------------------------------ | ------------------------------------------------------------ |
+|
|
|
+
+使用说明
+
+1. 在前端route.html页面点击超链接,可跳转到应用的ProfilePage.ets页面。
+
+### CrossApplicationRedirection
+
+#### 介绍
+
+本示例主要介绍页面管理及浏览记录导航功能,Web组件支持通过点击前端的超链接实现跨应用跳转。
+
+#### 效果预览
+
+|
|
|
+| ------------------------------------------------------------ | ------------------------------------------------------------ |
+
+使用说明
+
+1. 点击超链接导航至其它应用。
+
+### 工程目录
+
+```
+entry/src/main/
+|---ets
+|---|---entryability
+|---|---|---EntryAbility.ets
+|---|---pages
+|---|---|---CrossApplication Redirection.ets
+|---|---|---HistoryNavigati.ets
+|---|---|---Index.ets // 首页
+|---|---|---PageRedirection.ets
+|---|---|---ProfilePage.ets
+|---resources // 静态资源
+|---ohosTest
+|---|---ets
+|---|---|---tests
+|---|---|---|---Ability.test.ets // 自动化测试用例
+```
+
+
+### 相关权限
+
+[ohos.permission.INTERNET](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/security/AccessToken/permissions-for-all.md#ohospermissioninternet)
+
+### 依赖
+
+不涉及。
+
+### 约束与限制
+
+1. 本示例仅支持标准系统上运行,支持设备:华为手机。
+
+2. HarmonyOS系统:HarmonyOS 5.0.2 Release及以上。
+
+3. DevEco Studio版本:DevEco Studio 5.0.2 Release及以上。
+
+4. HarmonyOS SDK版本:HarmonyOS 5.0.2 Release及以上。
+
+### 下载
+
+如需单独下载本工程,执行如下命令:
+
+```
+git init
+git config core.sparsecheckout true
+echo ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav > .git/info/sparse-checkout
+git remote add origin https://gitee.com/harmonyos_samples/guide-snippets.git
+git pull origin master
+```
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/build-profile.json5 b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..9c284a291dc2cd15abf8025431e67aa253f01b81
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/build-profile.json5
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "app": {
+ "signingConfigs": [],
+ "products": [
+ {
+ "name": "default",
+ "signingConfig": "default",
+ "compatibleSdkVersion": "5.0.2(14)",
+ "targetSdkVersion": "5.0.2(14)",
+ "runtimeOS": "HarmonyOS",
+ }
+ ],
+ "buildModeSet": [
+ {
+ "name": "debug",
+ },
+ {
+ "name": "release"
+ }
+ ]
+ },
+ "modules": [
+ {
+ "name": "entry",
+ "srcPath": "./entry",
+ "targets": [
+ {
+ "name": "default",
+ "applyToProducts": [
+ "default"
+ ]
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/code-linter.json5 b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/code-linter.json5
new file mode 100644
index 0000000000000000000000000000000000000000..28586467ee7a761c737d8654a73aed6fddbc3c71
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/code-linter.json5
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "files": [
+ "**/*.ets"
+ ],
+ "ignore": [
+ "**/src/ohosTest/**/*",
+ "**/src/test/**/*",
+ "**/src/mock/**/*",
+ "**/node_modules/**/*",
+ "**/oh_modules/**/*",
+ "**/build/**/*",
+ "**/.preview/**/*"
+ ],
+ "ruleSet": [
+ "plugin:@performance/recommended",
+ "plugin:@typescript-eslint/recommended"
+ ],
+ "rules": {
+ }
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/.gitignore b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..e2713a2779c5a3e0eb879efe6115455592caeea5
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/.gitignore
@@ -0,0 +1,6 @@
+/node_modules
+/oh_modules
+/.preview
+/build
+/.cxx
+/.test
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/build-profile.json5 b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..e7569e3056e27af38e9991b7ea73ec10f3ba8a05
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/build-profile.json5
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "apiType": "stageMode",
+ "buildOption": {
+ },
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": false,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ }
+ }
+ }
+ },
+ ],
+ "targets": [
+ {
+ "name": "default"
+ },
+ {
+ "name": "ohosTest",
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/hvigorfile.ts b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..98d52319cb1dee60511b5716dba03b76e68a6d8b
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/hvigorfile.ts
@@ -0,0 +1,21 @@
+/*
+* Copyright (c) 2025 Huawei Device Co., Ltd.
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+import { hapTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/obfuscation-rules.txt b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/obfuscation-rules.txt
new file mode 100644
index 0000000000000000000000000000000000000000..272efb6ca3f240859091bbbfc7c5802d52793b0b
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/obfuscation-rules.txt
@@ -0,0 +1,23 @@
+# Define project specific obfuscation rules here.
+# You can include the obfuscation configuration files in the current module's build-profile.json5.
+#
+# For more details, see
+# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
+
+# Obfuscation options:
+# -disable-obfuscation: disable all obfuscations
+# -enable-property-obfuscation: obfuscate the property names
+# -enable-toplevel-obfuscation: obfuscate the names in the global scope
+# -compact: remove unnecessary blank spaces and all line feeds
+# -remove-log: remove all console.* statements
+# -print-namecache: print the name cache that contains the mapping from the old names to new names
+# -apply-namecache: reuse the given cache file
+
+# Keep options:
+# -keep-property-name: specifies property names that you want to keep
+# -keep-global-name: specifies names that you want to keep in the global scope
+
+-enable-property-obfuscation
+-enable-toplevel-obfuscation
+-enable-filename-obfuscation
+-enable-export-obfuscation
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/oh-package.json5 b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..c9cb6c8174858277c9b0d465a51547dcab16d5ff
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/oh-package.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "name": "entry",
+ "version": "1.0.0",
+ "description": "Please describe the basic information.",
+ "main": "",
+ "author": "",
+ "license": "",
+ "dependencies": {}
+}
+
diff --git a/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/ets/entryability/EntryAbility.ets b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/ets/entryability/EntryAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..23a5f218909827e91bf6f66ce3d472c99df7c7c2
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/ets/entryability/EntryAbility.ets
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { window } from '@kit.ArkUI';
+
+export default class EntryAbility extends UIAbility {
+ onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
+ }
+
+ onDestroy(): void {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
+ }
+
+ onWindowStageCreate(windowStage: window.WindowStage): void {
+ // Main window is created, set main page for this ability
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
+
+ windowStage.loadContent('pages/Index', (err) => {
+ if (err.code) {
+ hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
+ return;
+ }
+ hilog.info(0x0000, 'testTag', 'Succeeded in loading the content.');
+ });
+ }
+
+ onWindowStageDestroy(): void {
+ // Main window is destroyed, release UI related resources
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
+ }
+
+ onForeground(): void {
+ // Ability has brought to foreground
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
+ }
+
+ onBackground(): void {
+ // Ability has back to background
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
+ }
+}
diff --git a/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..b1e212947256c5533c7b06285a597c94f840a6e3
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit';
+
+export default class EntryBackupAbility extends BackupExtensionAbility {
+ async onBackup() {
+ hilog.info(0x0000, 'testTag', 'onBackup ok');
+ }
+
+ async onRestore(bundleVersion: BundleVersion) {
+ hilog.info(0x0000, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion));
+ }
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/ets/pages/CrossApplicationRedirection.ets b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/ets/pages/CrossApplicationRedirection.ets
new file mode 100644
index 0000000000000000000000000000000000000000..a449c95a90bfa7742231fc94c65d08cc41e49e20
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/ets/pages/CrossApplicationRedirection.ets
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { webview } from '@kit.ArkWeb';
+import { call } from '@kit.TelephonyKit';
+// [Start click_link_call_html_to_reach_phone_dialing_screen]
+@Entry
+@Component
+struct WebComponent {
+ webviewController: webview.WebviewController = new webview.WebviewController();
+
+ build() {
+ Column() {
+ Web({ src: $rawfile('call.html'), controller: this.webviewController })
+ .onLoadIntercept((event) => {
+ if (event) {
+ let url: string = event.data.getRequestUrl();
+ // 判断链接是否为拨号链接
+ if (url.indexOf('tel://') === 0) {
+ // 跳转拨号界面
+ call.makeCall(url.substring(6), (err) => {
+ if (!err) {
+ console.info('make call succeeded.');
+ } else {
+ console.info('make call fail, err is:' + JSON.stringify(err));
+ }
+ });
+ return true;
+ }
+ }
+ return false;
+ })
+ }
+ }
+}
+//[End click_link_call_html_to_reach_phone_dialing_screen]
diff --git a/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/ets/pages/HistoryNavigati.ets b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/ets/pages/HistoryNavigati.ets
new file mode 100644
index 0000000000000000000000000000000000000000..cf577c6cbf0c81e5995f9f18c2560fc73a455733
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/ets/pages/HistoryNavigati.ets
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { webview } from '@kit.ArkWeb';
+
+// [Start button_click_trigger_back]
+@Entry
+@Component
+struct WebComponent {
+ webviewController: webview.WebviewController = new webview.WebviewController();
+
+ build() {
+ Column() {
+ Button('loadData')
+ .onClick(() => {
+ if (this.webviewController.accessBackward()) {
+ this.webviewController.backward();
+ }
+ })
+ Web({ src: $r('app.string.web_path'), controller: this.webviewController });
+ }
+ }
+}
+// [End button_click_trigger_back]
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/ets/pages/Index.ets b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/ets/pages/Index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..4914a5f5df429036d7259d9a47334c52f77beb4a
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/ets/pages/Index.ets
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { router } from '@kit.ArkUI';
+
+@Entry
+@Component
+struct Index {
+ build() {
+ Column({ space: 10 }) {
+ Button('HistoryNavigati')
+ .onClick(() => {
+ router.pushUrl({ url: 'pages/HistoryNavigati' });
+ })
+ Button('PageRedirection')
+ .onClick(() => {
+ router.pushUrl({ url: 'pages/PageRedirection' });
+ })
+ Button('CrossApplicationRedirection')
+ .onClick(() => {
+ router.pushUrl({ url: 'pages/CrossApplicationRedirection' });
+ })
+ }.height('100%')
+ .width('100%')
+ }
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/ets/pages/PageRedirection.ets b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/ets/pages/PageRedirection.ets
new file mode 100644
index 0000000000000000000000000000000000000000..d57537f43fd67eb4d8e08905dfbdfd87dcf66fec
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/ets/pages/PageRedirection.ets
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { webview } from '@kit.ArkWeb';
+import { router } from '@kit.ArkUI';
+
+// [Start index_load_route_link_to_profile]
+@Entry
+@Component
+struct WebComponent {
+ webviewController: webview.WebviewController = new webview.WebviewController();
+
+ build() {
+ Column() {
+ // 资源文件route.html存放路径src/main/resources/rawfile
+ Web({ src: $rawfile('route.html'), controller: this.webviewController })
+ .onLoadIntercept((event) => {
+ if (event) {
+ let url: string = event.data.getRequestUrl();
+ if (url.indexOf('native://') === 0) {
+ // 跳转其他界面
+ router.pushUrl({ url: url.substring(9) });
+ return true;
+ }
+ }
+ return false;
+ })
+ }
+ }
+}
+// [End index_load_route_link_to_profile]
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/ets/pages/ProfilePage.ets b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/ets/pages/ProfilePage.ets
new file mode 100644
index 0000000000000000000000000000000000000000..fa930b9d9c7dfc80242309d1e9da19825de225b8
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/ets/pages/ProfilePage.ets
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// [Start navigate_to_profile_page]
+@Entry
+@Component
+struct ProfilePage {
+ @State message: string = 'Hello World';
+
+ build() {
+ Column() {
+ Text(this.message)
+ .fontSize(20)
+ }
+ }
+}
+// [End navigate_to_profile_page]
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/module.json5 b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..e9db80c0ac2d7edb8e5ed53f5e5eb5ccbb272a57
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/module.json5
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "module": {
+ "name": "entry",
+ "type": "entry",
+ "description": "$string:module_desc",
+ "mainElement": "EntryAbility",
+ "deviceTypes": [
+ "default",
+ "tablet"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false,
+ "pages": "$profile:main_pages",
+ "abilities": [
+ {
+ "name": "EntryAbility",
+ "srcEntry": "./ets/entryability/EntryAbility.ets",
+ "description": "$string:EntryAbility_desc",
+ "icon": "$media:layered_image",
+ "label": "$string:EntryAbility_label",
+ "startWindowIcon": "$media:startIcon",
+ "startWindowBackground": "$color:start_window_background",
+ "exported": true,
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ]
+ }
+ ],
+ "extensionAbilities": [
+ {
+ "name": "EntryBackupAbility",
+ "srcEntry": "./ets/entrybackupability/EntryBackupAbility.ets",
+ "type": "backup",
+ "exported": false,
+ "metadata": [
+ {
+ "name": "ohos.extension.backup",
+ "resource": "$profile:backup_config"
+ }
+ ]
+ }
+ ],
+ "requestPermissions": [
+ {
+ "name": "ohos.permission.INTERNET"
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/resources/base/element/color.json b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/resources/base/element/color.json
new file mode 100644
index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/resources/base/element/color.json
@@ -0,0 +1,8 @@
+{
+ "color": [
+ {
+ "name": "start_window_background",
+ "value": "#FFFFFF"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/resources/base/element/string.json b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..51119df58d8798ee0c2863b48d2a3ce7e940555b
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,20 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "ManagePageRedirectNav"
+ },
+ {
+ "name": "web_path",
+ "value": "https://www.example.com/cn/"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/resources/base/media/background.png b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/resources/base/media/background.png
new file mode 100644
index 0000000000000000000000000000000000000000..f939c9fa8cc8914832e602198745f592a0dfa34d
Binary files /dev/null and b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/resources/base/media/background.png differ
diff --git a/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/resources/base/media/foreground.png b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/resources/base/media/foreground.png
new file mode 100644
index 0000000000000000000000000000000000000000..4483ddad1f079e1089d685bd204ee1cfe1d01902
Binary files /dev/null and b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/resources/base/media/foreground.png differ
diff --git a/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/resources/base/media/layered_image.json b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/resources/base/media/layered_image.json
new file mode 100644
index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/resources/base/media/layered_image.json
@@ -0,0 +1,7 @@
+{
+ "layered-image":
+ {
+ "background" : "$media:background",
+ "foreground" : "$media:foreground"
+ }
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/resources/base/media/startIcon.png b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/resources/base/media/startIcon.png
new file mode 100644
index 0000000000000000000000000000000000000000..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b
Binary files /dev/null and b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/resources/base/media/startIcon.png differ
diff --git a/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/resources/base/profile/backup_config.json b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/resources/base/profile/backup_config.json
new file mode 100644
index 0000000000000000000000000000000000000000..78f40ae7c494d71e2482278f359ec790ca73471a
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/resources/base/profile/backup_config.json
@@ -0,0 +1,3 @@
+{
+ "allowToBackupRestore": true
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/resources/base/profile/main_pages.json b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/resources/base/profile/main_pages.json
new file mode 100644
index 0000000000000000000000000000000000000000..52f59acd8b0887f9a2cd26f9588d76ca542cb6d5
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/resources/base/profile/main_pages.json
@@ -0,0 +1,9 @@
+{
+ "src": [
+ "pages/Index",
+ "pages/HistoryNavigati",
+ "pages/PageRedirection",
+ "pages/CrossApplicationRedirection",
+ "pages/ProfilePage"
+ ]
+}
diff --git a/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/resources/en_US/element/string.json b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/resources/en_US/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..c25ce9fcda427231c8f659e42517bef4b4325c41
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/resources/en_US/element/string.json
@@ -0,0 +1,16 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "ManagePageRedirectNav"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/resources/rawfile/call.html b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/resources/rawfile/call.html
new file mode 100644
index 0000000000000000000000000000000000000000..ea7fea2546ac643d56202049eedb0da4cf3345ab
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/ManagePageRedirectNav/entry/src/main/resources/rawfile/call.html
@@ -0,0 +1,24 @@
+/*
+* Copyright (c) 2025 Huawei Device Co., Ltd.
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+
+
+
+
|
|
+
+使用说明
+
+1. 通过网络拦截接口对Web组件发出的请求进行拦截,并可以为被拦截的请求提供自定义的响应头以及响应体。
+1. 点击link链接请求视频资源,读取本地mp4文件。
+
+##### 工程目录
+
+```
+entry/src/main/
+|---cpp // cpp文件夹
+|---ets
+|---|---entryability
+|---|---|---EntryAbility.ets
+|---|---pages
+|---|---|---Index.ets // 首页
+|---resources // 静态资源
+|---ohosTest
+|---|---ets
+|---|---|---tests
+|---|---|---|---Ability.test.ets // 自动化测试用例
+```
+
+
+##### 相关权限
+
+[ohos.permission.INTERNET](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/security/AccessToken/permissions-for-all.md#ohospermissioninternet)
+
+## entry2:
+
+### Web组件前进后退缓存
+
+#### 介绍
+
+1. 本工程主要实现了对以下指南文档中 https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/web/web-set-back-forward-cache.md 示例代码片段的工程化,主要目标是实现指南中示例代码需要与sample工程文件同源。
+
+#### SetBackForwardCache
+
+##### 介绍
+
+1. 本示例主要设置Web组件前进后退缓存,Web组件为开发者提供了启用和配置前进后退缓存(以下简称BFCache)的功能。启用此功能后,能够显著提升用户返回至先前浏览网页的速度,开发者需要在调用initializeWebEngine()初始化ArkWeb内核之前调用enableBackForwardCache()来开启BFCache,启用BFCache后仅能存储一个页面,Web组件默认进入BFCache的页面可保持存活状态600秒。开发者可通过调用setBackForwardCacheOptions()设置每个Web实例的前进后退缓存策略,使BFCache能够容纳更多页面,从而在用户连续进行前进后退操作时,提供更快的加载速度。同时,开发者还能修改每个页面在缓存中的停留时间,延长页面在BFCache中的驻留期限,进而优化用户的浏览体验。
+
+##### 效果预览
+
+| 主页 | 超链接 |
+| ------------------------------------------------------------ | ------------------------------------------------------------ |
+|
|
|
+
+使用说明
+
+1. 点击Add options按钮设置Web组件可以缓存的数量上限为10,每个页面在缓存中停留300s。
+2. 点击Backward按钮会触发WebviewController的backward方法,使Web视图后退到上一个浏览页面(如果存在上一页面且在后退缓存范围内),实现类似以于浏览器后退按钮的功能。
+3. 点击Forward按钮调用WebviewController的forward方法,使Web视图前进到下一个浏览页面(如果存在下一页且在前进缓存范围内),与Backward按钮相对应。
+
+##### 工程目录
+
+```
+entry2/src/main/
+|---ets
+|---|---entry2ability
+|---|---|---Entry2Ability.ets
+|---|---pages
+|---|---|---Index.ets // 首页
+|---resources // 静态资源
+|---ohosTest
+|---|---ets
+|---|---|---tests
+|---|---|---|---Ability.test.ets // 自动化测试用例
+```
+
+
+##### 相关权限
+
+[ohos.permission.INTERNET](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/security/AccessToken/permissions-for-all.md#ohospermissioninternet)
+
+## entry3:
+
+### Web组件在不同的窗口间迁移
+
+#### 介绍
+
+1. 本工程主要实现了对以下指南文档中 https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/web/web-component-migrate.md 示例代码片段的工程化,主要目标是实现指南中示例代码需要与sample工程文件同源。
+
+#### MigrateWebCompWin
+
+##### 介绍
+
+1. 本示例主要介绍Web组件在不同的窗口间迁移,Web组件在不同窗口间迁移是基于自定义节点能力实现的。通过BuilderNode,开发者可创建Web组件的离线节点,并结合自定义占位节点控制Web节点的挂载与移除。当从一个窗口上移除Web节点并挂载到另一个窗口中,即完成Web组件在窗口间的迁移。
+
+##### 效果预览
+
+| 主页 | 挂载 |
+| ------------------------------------------------------------ | ------------------------------------------------------------ |
+|
|
|
+
+使用说明
+
+1. 点击 Attach Webview 按钮,挂载 Web 视图,刷新NodeContainer使 Web 视图显示在页面上。
+1. 点击 Detach Webview 按钮,卸载 Web 视图,刷新NodeContainer使 Web 视图将从页面上移除。
+
+##### 工程目录
+
+```
+entry3/src/main/
+|---ets
+|---|---entry3ability
+|---|---|---Entry3Ability.ets
+|---|---pages
+|---|---|---common.ets // 提供动态挂载Web组件能力
+|---|---|---Index.ets // 首页
+|---resources // 静态资源
+|---ohosTest
+|---|---ets
+|---|---|---tests
+|---|---|---|---Ability.test.ets // 自动化测试用例
+```
+
+
+##### 相关权限
+
+[ohos.permission.INTERNET](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/security/AccessToken/permissions-for-all.md#ohospermissioninternet)
+
+## 依赖
+
+不涉及。
+
+## 约束与限制
+
+1. 本示例仅支持标准系统上运行,支持设备:华为手机。
+
+2. HarmonyOS系统:HarmonyOS 5.0.2 Release及以上。
+
+3. DevEco Studio版本:DevEco Studio 5.0.2 Release及以上。
+
+4. HarmonyOS SDK版本:HarmonyOS 5.0.2 Release及以上。
+
+## 下载
+
+如需单独下载本工程,执行如下命令:
+
+```
+git init
+git config core.sparsecheckout true
+echo ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps > .git/info/sparse-checkout
+git remote add origin https://gitee.com/harmonyos_samples/guide-snippets.git
+git pull origin master
+```
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/build-profile.json5 b/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..638ae10f4bf8fc8c16156b4fdb6d62535fb58b28
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/build-profile.json5
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "app": {
+ "signingConfigs": [],
+ "products": [
+ {
+ "name": "default",
+ "signingConfig": "default",
+ "compatibleSdkVersion": "5.0.2(14)",
+ "targetSdkVersion": "5.0.2(14)",
+ "runtimeOS": "HarmonyOS",
+ }
+ ],
+ "buildModeSet": [
+ {
+ "name": "debug",
+ },
+ {
+ "name": "release"
+ }
+ ]
+ },
+ "modules": [
+ {
+ "name": "entry",
+ "srcPath": "./entry",
+ "targets": [
+ {
+ "name": "default",
+ "applyToProducts": [
+ "default"
+ ]
+ }
+ ]
+ },
+ {
+ "name": "entry2",
+ "srcPath": "./entry2",
+ "targets": [
+ {
+ "name": "default",
+ "applyToProducts": [
+ "default"
+ ]
+ }
+ ]
+ },
+ {
+ "name": "entry3",
+ "srcPath": "./entry3",
+ "targets": [
+ {
+ "name": "default",
+ "applyToProducts": [
+ "default"
+ ]
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/code-linter.json5 b/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/code-linter.json5
new file mode 100644
index 0000000000000000000000000000000000000000..28586467ee7a761c737d8654a73aed6fddbc3c71
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/code-linter.json5
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "files": [
+ "**/*.ets"
+ ],
+ "ignore": [
+ "**/src/ohosTest/**/*",
+ "**/src/test/**/*",
+ "**/src/mock/**/*",
+ "**/node_modules/**/*",
+ "**/oh_modules/**/*",
+ "**/build/**/*",
+ "**/.preview/**/*"
+ ],
+ "ruleSet": [
+ "plugin:@performance/recommended",
+ "plugin:@typescript-eslint/recommended"
+ ],
+ "rules": {
+ }
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry/.gitignore b/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..e2713a2779c5a3e0eb879efe6115455592caeea5
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry/.gitignore
@@ -0,0 +1,6 @@
+/node_modules
+/oh_modules
+/.preview
+/build
+/.cxx
+/.test
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry/build-profile.json5 b/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..f24addba76d1c74999c890245fdc45a1c681db97
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry/build-profile.json5
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "apiType": "stageMode",
+ "buildOption": {
+ "externalNativeOptions": {
+ "abiFilters": ["arm64-v8a", "x86_64"],
+ "path": "./src/main/cpp/CMakeLists.txt",
+ "arguments": "",
+ "cppFlags": "",
+ }
+ },
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": false,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ }
+ }
+ },
+ "nativeLib": {
+ "debugSymbol": {
+ "strip": true,
+ "exclude": []
+ }
+ }
+ },
+ ],
+ "targets": [
+ {
+ "name": "default"
+ },
+ {
+ "name": "ohosTest",
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry/hvigorfile.ts b/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..98d52319cb1dee60511b5716dba03b76e68a6d8b
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry/hvigorfile.ts
@@ -0,0 +1,21 @@
+/*
+* Copyright (c) 2025 Huawei Device Co., Ltd.
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+import { hapTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry/obfuscation-rules.txt b/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry/obfuscation-rules.txt
new file mode 100644
index 0000000000000000000000000000000000000000..272efb6ca3f240859091bbbfc7c5802d52793b0b
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry/obfuscation-rules.txt
@@ -0,0 +1,23 @@
+# Define project specific obfuscation rules here.
+# You can include the obfuscation configuration files in the current module's build-profile.json5.
+#
+# For more details, see
+# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
+
+# Obfuscation options:
+# -disable-obfuscation: disable all obfuscations
+# -enable-property-obfuscation: obfuscate the property names
+# -enable-toplevel-obfuscation: obfuscate the names in the global scope
+# -compact: remove unnecessary blank spaces and all line feeds
+# -remove-log: remove all console.* statements
+# -print-namecache: print the name cache that contains the mapping from the old names to new names
+# -apply-namecache: reuse the given cache file
+
+# Keep options:
+# -keep-property-name: specifies property names that you want to keep
+# -keep-global-name: specifies names that you want to keep in the global scope
+
+-enable-property-obfuscation
+-enable-toplevel-obfuscation
+-enable-filename-obfuscation
+-enable-export-obfuscation
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry/oh-package.json5 b/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..118bdd4fe7699368a010e04c24f5bfc887cf1298
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry/oh-package.json5
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "name": "entry",
+ "version": "1.0.0",
+ "description": "Please describe the basic information.",
+ "main": "",
+ "author": "",
+ "license": "",
+ "dependencies": {
+ "libentry.so": "file:./src/main/cpp/types/libentry"
+ }
+}
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry/src/main/cpp/CMakeLists.txt b/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry/src/main/cpp/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..1686eb5df713cd6fd4c5da0dd7aeeb5d580861a9
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry/src/main/cpp/CMakeLists.txt
@@ -0,0 +1,15 @@
+# the minimum version of CMake.
+cmake_minimum_required(VERSION 3.4.1)
+project(schemehandler)
+
+set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR})
+
+if(DEFINED PACKAGE_INFO_FILE)
+ include(${PACKAGE_INFO_FILE})
+endif()
+
+include_directories(${NATIVERENDER_ROOT_PATH}
+ ${NATIVERENDER_ROOT_PATH}/include)
+
+add_library(entry SHARED rawfile_request.cpp hello.cpp)
+target_link_libraries(entry PUBLIC librawfile.z.so libace_napi.z.so libohweb.so libhilog_ndk.z.so)
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry/src/main/cpp/hello.cpp b/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry/src/main/cpp/hello.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..7ece7e82f1eeb0ab691c41323648fe0d9a630881
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry/src/main/cpp/hello.cpp
@@ -0,0 +1,165 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start set_intercept_web_module_request_example]
+#include "hilog/log.h"
+#include "napi/native_api.h"
+#include "rawfile_request.h"
+#include "rawfile/raw_file_manager.h"
+#include "web/arkweb_scheme_handler.h"
+#include "web/arkweb_net_error_list.h"
+
+#undef LOG_TAG
+#define LOG_TAG "ss-handler"
+
+// [Start set_intercept_web_module_request]
+ArkWeb_SchemeHandler *g_schemeHandler;
+// [StartExclude set_intercept_web_module_request]
+ArkWeb_SchemeHandler *g_schemeHandlerForSW;
+NativeResourceManager *g_resourceManager;
+
+// 注册三方协议的配置,需要在Web内核初始化之前调用,否则会注册失败。
+static napi_value RegisterCustomSchemes(napi_env env, napi_callback_info info)
+{
+ OH_LOG_INFO(LOG_APP, "register custom schemes");
+ // [Start register_set_custom_schemes]
+ OH_ArkWeb_RegisterCustomSchemes("custom", ARKWEB_SCHEME_OPTION_STANDARD | ARKWEB_SCHEME_OPTION_CORS_ENABLED);
+ OH_ArkWeb_RegisterCustomSchemes("custom-local", ARKWEB_SCHEME_OPTION_LOCAL);
+ OH_ArkWeb_RegisterCustomSchemes(
+ "custom-csp-bypassing", ARKWEB_SCHEME_OPTION_CSP_BYPASSING | ARKWEB_SCHEME_OPTION_STANDARD);
+ OH_ArkWeb_RegisterCustomSchemes("custom-isolated", ARKWEB_SCHEME_OPTION_DISPLAY_ISOLATED);
+ // [End register_set_custom_schemes]
+ return nullptr;
+}
+
+// 请求开始的回调,在该函数中我们创建一个RawfileRequest来实现对Web内核请求的拦截。
+void OnURLRequestStart(const ArkWeb_SchemeHandler *schemeHandler,
+ ArkWeb_ResourceRequest *resourceRequest,
+ const ArkWeb_ResourceHandler *resourceHandler,
+ bool *intercept)
+{
+ *intercept = true;
+ RawfileRequest* request = new RawfileRequest(resourceRequest, resourceHandler, g_resourceManager);
+ OH_ArkWebResourceRequest_SetUserData(resourceRequest, request);
+ request->Start();
+}
+
+// 请求结束的回调,在该函数中我们需要标记RawfileRequest已经结束了,内部不应该再使用ResourceHandler。
+void OnURLRequestStop(const ArkWeb_SchemeHandler *schemeHandler,
+ const ArkWeb_ResourceRequest *request)
+{
+ if (!request) {
+ OH_LOG_ERROR(LOG_APP, "on request stop request is nullptr.");
+ return;
+ }
+
+ RawfileRequest *rawfileRequest = (RawfileRequest *)OH_ArkWebResourceRequest_GetUserData(request);
+ if (rawfileRequest) {
+ rawfileRequest->Stop();
+ }
+}
+
+void OnURLRequestStartForSW(const ArkWeb_SchemeHandler *schemeHandler,
+ ArkWeb_ResourceRequest *resourceRequest,
+ const ArkWeb_ResourceHandler *resourceHandler,
+ bool *intercept)
+{
+ *intercept = true;
+ RawfileRequest* request = new RawfileRequest(resourceRequest, resourceHandler, g_resourceManager);
+ OH_ArkWebResourceRequest_SetUserData(resourceRequest, request);
+ request->Start();
+}
+
+void OnURLRequestStopForSW(const ArkWeb_SchemeHandler *schemeHandler,
+ const ArkWeb_ResourceRequest *request)
+{
+ if (!request) {
+ OH_LOG_ERROR(LOG_APP, "on request stop request is nullptr.");
+ return;
+ }
+
+ RawfileRequest *rawfileRequest = (RawfileRequest *)OH_ArkWebResourceRequest_GetUserData(request);
+ if (rawfileRequest) {
+ rawfileRequest->Stop();
+ }
+}
+
+// 设置SchemeHandler。
+static napi_value SetSchemeHandler(napi_env env, napi_callback_info info)
+{
+ OH_LOG_INFO(LOG_APP, "set scheme handler");
+ // [EndExclude set_intercept_web_module_request]
+ // [Start set_intercept_web_module_request_custom]
+ OH_ArkWeb_CreateSchemeHandler(&g_schemeHandler);
+ OH_ArkWeb_CreateSchemeHandler(&g_schemeHandlerForSW);
+
+ OH_ArkWebSchemeHandler_SetOnRequestStart(g_schemeHandler, OnURLRequestStart);
+ OH_ArkWebSchemeHandler_SetOnRequestStop(g_schemeHandler, OnURLRequestStop);
+
+ // [StartExclude set_intercept_web_module_request_custom]
+ OH_ArkWebSchemeHandler_SetOnRequestStart(g_schemeHandlerForSW, OnURLRequestStart);
+ OH_ArkWebSchemeHandler_SetOnRequestStop(g_schemeHandlerForSW, OnURLRequestStop);
+ // [EndExclude set_intercept_web_module_request_custom]
+
+ OH_ArkWeb_SetSchemeHandler("custom", "scheme-handler", g_schemeHandler);
+ OH_ArkWeb_SetSchemeHandler("custom-csp-bypassing", "scheme-handler", g_schemeHandler);
+ OH_ArkWeb_SetSchemeHandler("custom-isolated", "scheme-handler", g_schemeHandler);
+ OH_ArkWeb_SetSchemeHandler("custom-local", "scheme-handler", g_schemeHandler);
+ // [End set_intercept_web_module_request_custom]
+ OH_ArkWeb_SetSchemeHandler("https", "scheme-handler", g_schemeHandler);
+ OH_ArkWeb_SetSchemeHandler("http", "scheme-handler", g_schemeHandler);
+ // [End set_intercept_web_module_request]
+
+ OH_ArkWebServiceWorker_SetSchemeHandler("https", g_schemeHandlerForSW);
+ return nullptr;
+}
+
+static napi_value InitResourceManager(napi_env env, napi_callback_info info)
+{
+ size_t argc = 2;
+ napi_value argv[2] = {nullptr};
+ napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
+ g_resourceManager = OH_ResourceManager_InitNativeResourceManager(env, argv[0]);
+ return nullptr;
+}
+
+EXTERN_C_START
+static napi_value Init(napi_env env, napi_value exports)
+{
+ napi_property_descriptor desc[] = {
+ {"setSchemeHandler", nullptr, SetSchemeHandler, nullptr, nullptr, nullptr, napi_default, nullptr},
+ {"initResourceManager", nullptr, InitResourceManager, nullptr, nullptr, nullptr, napi_default, nullptr},
+ {"registerCustomSchemes", nullptr, RegisterCustomSchemes, nullptr, nullptr, nullptr, napi_default, nullptr}
+ };
+ napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc);
+ return exports;
+}
+EXTERN_C_END
+
+static napi_module demoModule = {
+ .nm_version = 1,
+ .nm_flags = 0,
+ .nm_filename = nullptr,
+ .nm_register_func = Init,
+ .nm_modname = "entry",
+ .nm_priv = ((void*)0),
+ .reserved = { 0 },
+};
+
+extern "C" __attribute__((constructor)) void RegisterEntryModule(void)
+{
+ napi_module_register(&demoModule);
+}
+// [End set_intercept_web_module_request_example]
\ No newline at end of file
diff --git a/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry/src/main/cpp/napi_init.cpp b/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry/src/main/cpp/napi_init.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..3c11c8b57c075b5322df845f7fdc371f8b49caa0
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry/src/main/cpp/napi_init.cpp
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "napi/native_api.h"
+
+static napi_value Add(napi_env env, napi_callback_info info)
+{
+ size_t argc = 2;
+ napi_value args[2] = {nullptr};
+
+ napi_get_cb_info(env, info, &argc, args, nullptr, nullptr);
+
+ napi_valuetype valuetype0;
+ napi_typeof(env, args[0], &valuetype0);
+
+ napi_valuetype valuetype1;
+ napi_typeof(env, args[1], &valuetype1);
+
+ double value0;
+ napi_get_value_double(env, args[0], &value0);
+
+ double value1;
+ napi_get_value_double(env, args[1], &value1);
+
+ napi_value sum;
+ napi_create_double(env, value0 + value1, &sum);
+
+ return sum;
+}
+
+EXTERN_C_START
+static napi_value Init(napi_env env, napi_value exports)
+{
+ napi_property_descriptor desc[] = {
+ { "add", nullptr, Add, nullptr, nullptr, nullptr, napi_default, nullptr }
+ };
+ napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc);
+ return exports;
+}
+EXTERN_C_END
+
+static napi_module demoModule = {
+ .nm_version = 1,
+ .nm_flags = 0,
+ .nm_filename = nullptr,
+ .nm_register_func = Init,
+ .nm_modname = "entry",
+ .nm_priv = ((void*)0),
+ .reserved = { 0 },
+};
+
+extern "C" __attribute__((constructor)) void RegisterEntryModule(void)
+{
+ napi_module_register(&demoModule);
+}
diff --git a/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry/src/main/cpp/rawfile_request.cpp b/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry/src/main/cpp/rawfile_request.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..a3ce2921a733d274ed070f46475e2d5edac50ece
--- /dev/null
+++ b/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry/src/main/cpp/rawfile_request.cpp
@@ -0,0 +1,289 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start intercepted_request_processing_cpp]
+#include "rawfile_request.h"
+#include "threads.h"
+
+#include "hilog/log.h"
+#include "rawfile/raw_file.h"
+#include "rawfile/raw_file_manager.h"
+
+#undef LOG_TAG
+#define LOG_TAG "ss-handler"
+
+namespace {
+
+uint8_t g_buffer[1024];
+cnd_t g_httpBodyCnd;
+mtx_t g_httpBodyMtx;
+const int HTTP_OK = 200;
+const int HTTP_NOT_FOUND = 404;
+const int BUFFER_SIZE = 1000;
+
+// HttpBodyStream的读回调。
+void ReadCallback(const ArkWeb_HttpBodyStream *httpBodyStream, uint8_t* buffer, int bytesRead)
+{
+ OH_LOG_INFO(LOG_APP, "read http body back.");
+ bool isEof = OH_ArkWebHttpBodyStream_IsEof(httpBodyStream);
+ if (!isEof && bytesRead != 0) {
+ memset(buffer, 0, BUFFER_SIZE);
+ OH_ArkWebHttpBodyStream_Read(httpBodyStream, buffer, BUFFER_SIZE);
+ } else {
+ RawfileRequest *rawfileRequest = (RawfileRequest *)OH_ArkWebHttpBodyStream_GetUserData(httpBodyStream);
+ if (rawfileRequest) {
+ rawfileRequest->ReadRawfileDataOnWorkerThread();
+ cnd_signal(&g_httpBodyCnd);
+ }
+ }
+}
+
+int ReadHttpBodyOnWorkerThread(void* userData)
+{
+ memset(g_buffer, 0, BUFFER_SIZE);
+ ArkWeb_HttpBodyStream *httpBodyStream = (ArkWeb_HttpBodyStream *)userData;
+ OH_ArkWebHttpBodyStream_Read(httpBodyStream, g_buffer, BUFFER_SIZE);
+ int initResult = cnd_init(&g_httpBodyCnd);
+ if (initResult == 0) {
+ OH_LOG_INFO(LOG_APP, "cnd_init success.");
+ } else {
+ OH_LOG_INFO(LOG_APP, "cnd_init fail.");
+ }
+ int mtxResult = mtx_init(&g_httpBodyMtx, mtx_plain);
+ if (mtxResult == 0) {
+ OH_LOG_INFO(LOG_APP, "mtx_init success.");
+ } else {
+ OH_LOG_INFO(LOG_APP, "mtx_init fail.");
+ }
+ int waitResult = cnd_wait(&g_httpBodyCnd, &g_httpBodyMtx);
+ if (waitResult == 0) {
+ OH_LOG_INFO(LOG_APP, "cnd_wait success.");
+ } else {
+ OH_LOG_INFO(LOG_APP, "cnd_wait fail.");
+ }
+ return 0;
+}
+
+int ReadRawfileOnWorkerThread(void* userData)
+{
+ RawfileRequest* rawfileRequest = (RawfileRequest*)userData;
+ if (rawfileRequest) {
+ rawfileRequest->ReadRawfileDataOnWorkerThread();
+ }
+ return 0;
+}
+
+// ArkWeb_HttpBodyStream的初始化回调。
+void InitCallback(const ArkWeb_HttpBodyStream *httpBodyStream, ArkWeb_NetError result)
+{
+ OH_LOG_INFO(LOG_APP, "init http body stream done %{public}d.", result);
+ bool isChunked = OH_ArkWebHttpBodyStream_IsChunked(httpBodyStream);
+ OH_LOG_INFO(LOG_APP, "http body stream is chunked %{public}d.", isChunked);
+ thrd_t th;
+ if (thrd_create(&th, ReadHttpBodyOnWorkerThread, (void *)httpBodyStream) != thrd_success) {
+ OH_LOG_ERROR(LOG_APP, "create thread failed.");
+ return;
+ }
+
+ if (thrd_detach(th) != thrd_success) {
+ OH_LOG_ERROR(LOG_APP, "detach thread failed.");
+ }
+}
+
+const int BLOCK_SIZE = 1024 * 8;
+const int MAXWHILE = 100;
+
+} // namespace
+
+RawfileRequest::RawfileRequest(const ArkWeb_ResourceRequest *resourceRequest,
+ const ArkWeb_ResourceHandler *resourceHandler,
+ const NativeResourceManager* resourceManager)
+ : resourceRequest_(resourceRequest),
+ resourceHandler_(resourceHandler),
+ resourceManager_(resourceManager) {}
+
+RawfileRequest::~RawfileRequest() {}
+
+void RawfileRequest::Start()
+{
+ OH_LOG_INFO(LOG_APP, "start a rawfile request.");
+ // [Start get_intercepted_request_info]
+ char* url;
+ OH_ArkWebResourceRequest_GetUrl(resourceRequest_, &url);
+ std::string urlStr(url);
+ std::size_t position = urlStr.rfind('/');
+ if (position != std::string::npos) {
+ rawfilePath_ = urlStr.substr(position + 1);
+ }
+ OH_ArkWeb_ReleaseString(url);
+ // [End get_intercepted_request_info]
+
+ // [Start set_intercepted_request_response]
+ // [StartExclude set_intercepted_request_response]
+ OH_ArkWeb_CreateResponse(&response_);
+ // [EndExclude set_intercepted_request_response]
+ OH_ArkWebResourceRequest_GetHttpBodyStream(resourceRequest(), &stream_);
+ if (stream_) {
+ OH_LOG_ERROR(LOG_APP, "have http body stream");
+ // [Start get_put_post_request_data]
+ OH_ArkWebHttpBodyStream_SetUserData(stream_, this);
+ OH_ArkWebHttpBodyStream_SetReadCallback(stream_, ReadCallback);
+ OH_ArkWebHttpBodyStream_Init(stream_, InitCallback);
+ // [End get_put_post_request_data]
+ } else {
+ thrd_t th;
+ if (thrd_create(&th, ReadRawfileOnWorkerThread, static_castscheme: custom-csp-bypassing
+options: ARKWEB_SCHEME_OPTION_CSP_BYPASSING | ARKWEB_SCHEME_OPTION_STANDARD
+ + + diff --git a/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry/src/main/resources/rawfile/csp_script.js b/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry/src/main/resources/rawfile/csp_script.js new file mode 100644 index 0000000000000000000000000000000000000000..8621810e79f5f987fbc16a20cd72200d33fe140a --- /dev/null +++ b/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry/src/main/resources/rawfile/csp_script.js @@ -0,0 +1,21 @@ +/* +* Copyright (c) 2025 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// [Start csp_rules_java_script] +const body = document.body; +const element = document.createElement('div'); +element.textContent = 'csp_script.js bypass the csp rules'; +body.appendChild(element); +// [End csp_rules_java_script] diff --git a/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry/src/main/resources/rawfile/isolated.html b/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry/src/main/resources/rawfile/isolated.html new file mode 100644 index 0000000000000000000000000000000000000000..bc04b313506d81f61fb720c4df39f99f9138d500 --- /dev/null +++ b/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry/src/main/resources/rawfile/isolated.html @@ -0,0 +1,26 @@ + + + + + + + +scheme: custom-isolated
+options: ARKWEB_SCHEME_OPTION_DISPLAY_ISOLATED
+scheme: custom-local
+options: ARKWEB_SCHEME_OPTION_LOCAL
+