1/* 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file 18 * @kit ArkWeb 19 */ 20 21import { AsyncCallback, BusinessError } from './@ohos.base'; 22import { Callback } from './@ohos.base'; 23import cert from './@ohos.security.cert'; 24import image from './@ohos.multimedia.image'; 25import type print from './@ohos.print'; 26import { WebNetErrorList } from './@ohos.web.netErrorList'; 27 28/** 29 * This module provides the capability to manage web modules. 30 * 31 * @namespace webview 32 * @syscap SystemCapability.Web.Webview.Core 33 * @since 9 34 */ 35/** 36 * This module provides the capability to manage web modules. 37 * 38 * @namespace webview 39 * @syscap SystemCapability.Web.Webview.Core 40 * @crossplatform 41 * @since 10 42 */ 43/** 44 * This module provides the capability to manage web modules. 45 * 46 * @namespace webview 47 * @syscap SystemCapability.Web.Webview.Core 48 * @crossplatform 49 * @atomicservice 50 * @since 11 51 */ 52declare namespace webview { 53 /** 54 * Defines the Web's request/response header. 55 * 56 * @interface WebHeader 57 * @syscap SystemCapability.Web.Webview.Core 58 * @since 9 59 */ 60 /** 61 * Defines the Web's request/response header. 62 * 63 * @interface WebHeader 64 * @syscap SystemCapability.Web.Webview.Core 65 * @crossplatform 66 * @since 10 67 */ 68 /** 69 * Defines the Web's request/response header. 70 * 71 * @interface WebHeader 72 * @syscap SystemCapability.Web.Webview.Core 73 * @crossplatform 74 * @atomicservice 75 * @since 11 76 */ 77 /** 78 * Defines the Web's request/response header. 79 * 80 * @typedef WebHeader 81 * @syscap SystemCapability.Web.Webview.Core 82 * @crossplatform 83 * @atomicservice 84 * @since 12 85 */ 86 interface WebHeader { 87 /** 88 * Gets the key of the request/response header. 89 * @syscap SystemCapability.Web.Webview.Core 90 * @since 9 91 */ 92 /** 93 * Gets the key of the request/response header. 94 * @syscap SystemCapability.Web.Webview.Core 95 * @crossplatform 96 * @since 10 97 */ 98 /** 99 * Gets the key of the request/response header. 100 * @type { string } 101 * @syscap SystemCapability.Web.Webview.Core 102 * @crossplatform 103 * @atomicservice 104 * @since 11 105 */ 106 headerKey: string; 107 108 /** 109 * Gets the value of the request/response header. 110 * @syscap SystemCapability.Web.Webview.Core 111 * @since 9 112 */ 113 /** 114 * Gets the value of the request/response header. 115 * @syscap SystemCapability.Web.Webview.Core 116 * @crossplatform 117 * @since 10 118 */ 119 /** 120 * Gets the value of the request/response header. 121 * @type { string } 122 * @syscap SystemCapability.Web.Webview.Core 123 * @crossplatform 124 * @atomicservice 125 * @since 11 126 */ 127 headerValue: string; 128 } 129 130 /** 131 * Enum type supplied to {@link getHitTest} for indicating the cursor node HitTest. 132 * @enum {number} 133 * @syscap SystemCapability.Web.Webview.Core 134 * @since 9 135 */ 136 /** 137 * Enum type supplied to {@link getHitTest} for indicating the cursor node HitTest. 138 * @enum {number} 139 * @syscap SystemCapability.Web.Webview.Core 140 * @atomicservice 141 * @since 11 142 */ 143 enum WebHitTestType { 144 /** 145 * The edit text. 146 * @syscap SystemCapability.Web.Webview.Core 147 * @since 9 148 */ 149 /** 150 * The edit text. 151 * @syscap SystemCapability.Web.Webview.Core 152 * @atomicservice 153 * @since 11 154 */ 155 EditText, 156 157 /** 158 * The email address. 159 * @syscap SystemCapability.Web.Webview.Core 160 * @since 9 161 */ 162 /** 163 * The email address. 164 * @syscap SystemCapability.Web.Webview.Core 165 * @atomicservice 166 * @since 11 167 */ 168 Email, 169 170 /** 171 * The HTML::a tag with src=http. 172 * @syscap SystemCapability.Web.Webview.Core 173 * @since 9 174 */ 175 /** 176 * The HTML::a tag with src=http. 177 * @syscap SystemCapability.Web.Webview.Core 178 * @atomicservice 179 * @since 11 180 */ 181 HttpAnchor, 182 183 /** 184 * The HTML::a tag with src=http + HTML::img. 185 * @syscap SystemCapability.Web.Webview.Core 186 * @since 9 187 */ 188 /** 189 * The HTML::a tag with src=http + HTML::img. 190 * @syscap SystemCapability.Web.Webview.Core 191 * @atomicservice 192 * @since 11 193 */ 194 HttpAnchorImg, 195 196 /** 197 * The HTML::img tag. 198 * @syscap SystemCapability.Web.Webview.Core 199 * @since 9 200 */ 201 /** 202 * The HTML::img tag. 203 * @syscap SystemCapability.Web.Webview.Core 204 * @atomicservice 205 * @since 11 206 */ 207 Img, 208 209 /** 210 * The map address. 211 * @syscap SystemCapability.Web.Webview.Core 212 * @since 9 213 */ 214 /** 215 * The map address. 216 * @syscap SystemCapability.Web.Webview.Core 217 * @atomicservice 218 * @since 11 219 */ 220 Map, 221 222 /** 223 * The phone number. 224 * @syscap SystemCapability.Web.Webview.Core 225 * @since 9 226 */ 227 /** 228 * The phone number. 229 * @syscap SystemCapability.Web.Webview.Core 230 * @atomicservice 231 * @since 11 232 */ 233 Phone, 234 235 /** 236 * Other unknown HitTest. 237 * @syscap SystemCapability.Web.Webview.Core 238 * @since 9 239 */ 240 /** 241 * Other unknown HitTest. 242 * @syscap SystemCapability.Web.Webview.Core 243 * @atomicservice 244 * @since 11 245 */ 246 Unknown 247 } 248 249 /** 250 * Defines the mode for using HttpDns. 251 * @enum {number} 252 * @syscap SystemCapability.Web.Webview.Core 253 * @since 10 254 */ 255 /** 256 * Defines the mode for using HttpDns. 257 * @enum {number} 258 * @syscap SystemCapability.Web.Webview.Core 259 * @atomicservice 260 * @since 11 261 */ 262 enum SecureDnsMode { 263 /** 264 * Do not use HttpDns, can be used to revoke previously used HttpDns configuration. 265 * @syscap SystemCapability.Web.Webview.Core 266 * @since 10 267 */ 268 /** 269 * Do not use HttpDns, can be used to revoke previously used HttpDns configuration. 270 * @syscap SystemCapability.Web.Webview.Core 271 * @atomicservice 272 * @since 11 273 */ 274 OFF = 0, 275 /** 276 * By default, the user-settings of HttpDns is used for dns resolution, and if it fails, 277 * the system dns is used for resolution. 278 * @syscap SystemCapability.Web.Webview.Core 279 * @since 10 280 */ 281 /** 282 * By default, the user-settings of HttpDns is used for dns resolution, and if it fails, 283 * the system dns is used for resolution. 284 * @syscap SystemCapability.Web.Webview.Core 285 * @atomicservice 286 * @since 11 287 */ 288 AUTO = 1, 289 /** 290 * Use the user-settings of HttpDns for dns resolution. If it fails, it will not 291 * fall back to the system dns, which will directly cause the page to fail to load. 292 * @syscap SystemCapability.Web.Webview.Core 293 * @since 10 294 */ 295 /** 296 * Use the user-settings of HttpDns for dns resolution. If it fails, it will not 297 * fall back to the system dns, which will directly cause the page to fail to load. 298 * @syscap SystemCapability.Web.Webview.Core 299 * @atomicservice 300 * @since 11 301 */ 302 SECURE_ONLY = 2, 303 } 304 305 /** 306 * Defines the security level for the page. 307 * 308 * @enum {number} 309 * @syscap SystemCapability.Web.Webview.Core 310 * @atomicservice 311 * @since 11 312 */ 313 enum SecurityLevel { 314 /** 315 * Unable to determine whether it is safe or not, the non-http/https protocol used. 316 * 317 * @syscap SystemCapability.Web.Webview.Core 318 * @atomicservice 319 * @since 11 320 */ 321 NONE = 0, 322 323 /** 324 * Indicates the HTTPS protocol used by the page and the authentication is successful. 325 * 326 * @syscap SystemCapability.Web.Webview.Core 327 * @atomicservice 328 * @since 11 329 */ 330 SECURE = 1, 331 332 /** 333 * The page is insecure. For example, the HTTP protocol is used or the HTTPS protocol 334 * is used but use an legacy TLS version. 335 * 336 * @syscap SystemCapability.Web.Webview.Core 337 * @atomicservice 338 * @since 11 339 */ 340 WARNING = 2, 341 342 /** 343 * Attempted HTTPS and failed, the authentication is failed. 344 * 345 * @syscap SystemCapability.Web.Webview.Core 346 * @atomicservice 347 * @since 11 348 */ 349 DANGEROUS = 3, 350 } 351 352 /** 353 * The playback status of all audio and video. 354 * @enum {number} 355 * @syscap SystemCapability.Web.Webview.Core 356 * @atomicservice 357 * @since 12 358 */ 359 enum MediaPlaybackState { 360 /** 361 * No audio or video currently. 362 * @syscap SystemCapability.Web.Webview.Core 363 * @atomicservice 364 * @since 12 365 */ 366 NONE = 0, 367 368 /** 369 * All audio and video are playing. 370 * @syscap SystemCapability.Web.Webview.Core 371 * @atomicservice 372 * @since 12 373 */ 374 PLAYING = 1, 375 376 /** 377 * All audio and video are paused. 378 * @syscap SystemCapability.Web.Webview.Core 379 * @atomicservice 380 * @since 12 381 */ 382 PAUSED = 2, 383 384 /** 385 * All audio and video are stopped. 386 * @syscap SystemCapability.Web.Webview.Core 387 * @atomicservice 388 * @since 12 389 */ 390 STOPPED = 3 391 } 392 393 /** 394 * The memory pressure level that can be set. 395 * @enum {number} 396 * @syscap SystemCapability.Web.Webview.Core 397 * @atomicservice 398 * @since 14 399 */ 400 enum PressureLevel { 401 /** 402 * Modules are advised to free buffers that are cheap to re-allocate and not immediately needed. 403 * @syscap SystemCapability.Web.Webview.Core 404 * @atomicservice 405 * @since 14 406 */ 407 MEMORY_PRESSURE_LEVEL_MODERATE = 1, 408 409 /** 410 * At this level, modules are advised to free all possible memory. 411 * @syscap SystemCapability.Web.Webview.Core 412 * @atomicservice 413 * @since 14 414 */ 415 MEMORY_PRESSURE_LEVEL_CRITICAL = 2 416 } 417 418 /** 419 * Defines the hit test value, related to {@link getHitTestValue} method. 420 * 421 * @interface HitTestValue 422 * @syscap SystemCapability.Web.Webview.Core 423 * @since 9 424 */ 425 /** 426 * Defines the hit test value, related to {@link getHitTestValue} method. 427 * 428 * @interface HitTestValue 429 * @syscap SystemCapability.Web.Webview.Core 430 * @atomicservice 431 * @since 11 432 */ 433 /** 434 * Defines the hit test value, related to {@link getHitTestValue} method. 435 * 436 * @typedef HitTestValue 437 * @syscap SystemCapability.Web.Webview.Core 438 * @atomicservice 439 * @since 12 440 */ 441 interface HitTestValue { 442 443 /** 444 * Get the hit test type. 445 * 446 * @syscap SystemCapability.Web.Webview.Core 447 * @since 9 448 */ 449 /** 450 * Get the hit test type. 451 * 452 * @type { WebHitTestType } 453 * @syscap SystemCapability.Web.Webview.Core 454 * @atomicservice 455 * @since 11 456 */ 457 type: WebHitTestType; 458 459 /** 460 * Get the hit test extra data. 461 * 462 * @syscap SystemCapability.Web.Webview.Core 463 * @since 9 464 */ 465 /** 466 * Get the hit test extra data. 467 * 468 * @type { string } 469 * @syscap SystemCapability.Web.Webview.Core 470 * @atomicservice 471 * @since 11 472 */ 473 extra: string; 474 } 475 476 /** 477 * Defines the configuration of web custom scheme, related to {@link customizeSchemes} method. 478 * 479 * @interface WebCustomScheme 480 * @syscap SystemCapability.Web.Webview.Core 481 * @since 9 482 */ 483 /** 484 * Defines the configuration of web custom scheme, related to {@link customizeSchemes} method. 485 * 486 * @interface WebCustomScheme 487 * @syscap SystemCapability.Web.Webview.Core 488 * @atomicservice 489 * @since 11 490 */ 491 /** 492 * Defines the configuration of web custom scheme, related to {@link customizeSchemes} method. 493 * 494 * @typedef WebCustomScheme 495 * @syscap SystemCapability.Web.Webview.Core 496 * @atomicservice 497 * @since 12 498 */ 499 interface WebCustomScheme { 500 501 /** 502 * Name of the custom scheme. 503 * 504 * @syscap SystemCapability.Web.Webview.Core 505 * @since 9 506 */ 507 /** 508 * Name of the custom scheme. 509 * 510 * @type { string } 511 * @syscap SystemCapability.Web.Webview.Core 512 * @atomicservice 513 * @since 11 514 */ 515 schemeName: string; 516 517 /** 518 * Whether Cross-Origin Resource Sharing is supported. 519 * 520 * @syscap SystemCapability.Web.Webview.Core 521 * @since 9 522 */ 523 /** 524 * Whether Cross-Origin Resource Sharing is supported. 525 * 526 * @type { boolean } 527 * @syscap SystemCapability.Web.Webview.Core 528 * @atomicservice 529 * @since 11 530 */ 531 isSupportCORS: boolean; 532 533 /** 534 * Whether fetch request is supported. 535 * 536 * @syscap SystemCapability.Web.Webview.Core 537 * @since 9 538 */ 539 /** 540 * Whether fetch request is supported. 541 * 542 * @type { boolean } 543 * @syscap SystemCapability.Web.Webview.Core 544 * @atomicservice 545 * @since 11 546 */ 547 isSupportFetch: boolean; 548 549 /** 550 * If isStandard is true, the scheme will be handled as a standard scheme. The standard 551 * schemes needs to comply with the URL normalization and parsing rules defined in Section 3.1 of RFC 1738, 552 * which can be found in the http://www.ietf.org/rfc/rfc1738.txt. 553 * 554 * @type { ?boolean } 555 * @syscap SystemCapability.Web.Webview.Core 556 * @atomicservice 557 * @since 12 558 */ 559 isStandard?: boolean; 560 561 /** 562 * If isLocal is true, the same security rules as those applied to the "file" URL will be 563 * used to handle the scheme. 564 * 565 * @type { ?boolean } 566 * @syscap SystemCapability.Web.Webview.Core 567 * @atomicservice 568 * @since 12 569 */ 570 isLocal?: boolean; 571 572 /** 573 * If isDisplayIsolated is true, then the scheme can only be displayed from other content 574 * hosted using the same scheme. 575 * 576 * @type { ?boolean } 577 * @syscap SystemCapability.Web.Webview.Core 578 * @atomicservice 579 * @since 12 580 */ 581 isDisplayIsolated?: boolean; 582 583 /** 584 * If isSecure is true, the same security rules as those applied to the "https" URL will be 585 * used to handle the scheme. 586 * 587 * @type { ?boolean } 588 * @syscap SystemCapability.Web.Webview.Core 589 * @atomicservice 590 * @since 12 591 */ 592 isSecure?: boolean; 593 594 /** 595 * If isCspBypassing is true, then this scheme can bypass Content Security Policy (CSP) 596 * checks. In most cases, this value should not be true when isStandard is true. 597 * 598 * @type { ?boolean } 599 * @syscap SystemCapability.Web.Webview.Core 600 * @atomicservice 601 * @since 12 602 */ 603 isCspBypassing?: boolean; 604 605 /** 606 * If isCodeCacheSupported is true, then the js of this scheme can generate code cache. 607 * 608 * @type { ?boolean } 609 * @syscap SystemCapability.Web.Webview.Core 610 * @since 12 611 */ 612 isCodeCacheSupported?: boolean; 613 } 614 615 /** 616 * Defines the callback of createPdf, related to {@link createPDF} method. 617 * 618 * @syscap SystemCapability.Web.Webview.Core 619 * @atomicservice 620 * @since 14 621 */ 622 class PdfData { 623 /** 624 * Return the data stream generated by the webpage. 625 * 626 * @returns { Uint8Array } return pdf data. 627 * @syscap SystemCapability.Web.Webview.Core 628 * @atomicservice 629 * @since 14 630 */ 631 pdfArrayBuffer(): Uint8Array; 632 } 633 634 /** 635 * Defines the configuration of creating pdf, related to {@Link createPdf} method. 636 * 637 * @typedef PdfConfiguration 638 * @syscap SystemCapability.Web.Webview.Core 639 * @atomicservice 640 * @since 14 641 */ 642 interface PdfConfiguration { 643 /** 644 * Number of the width. 645 * 646 * @type { number } 647 * @syscap SystemCapability.Web.Webview.Core 648 * @atomicservice 649 * @since 14 650 */ 651 width: number; 652 653 /** 654 * Number of the height. 655 * 656 * @type { number } 657 * @syscap SystemCapability.Web.Webview.Core 658 * @atomicservice 659 * @since 14 660 */ 661 height: number; 662 663 /** 664 * Number of the marginTop. 665 * 666 * @type { number } 667 * @syscap SystemCapability.Web.Webview.Core 668 * @atomicservice 669 * @since 14 670 */ 671 marginTop: number; 672 673 /** 674 * Number of the marginBottom. 675 * 676 * @type { number } 677 * @syscap SystemCapability.Web.Webview.Core 678 * @atomicservice 679 * @since 14 680 */ 681 marginBottom: number; 682 683 /** 684 * Number of the marginRight. 685 * 686 * @type { number } 687 * @syscap SystemCapability.Web.Webview.Core 688 * @atomicservice 689 * @since 14 690 */ 691 marginRight: number; 692 693 /** 694 * Number of the marginLeft. 695 * 696 * @type { number } 697 * @syscap SystemCapability.Web.Webview.Core 698 * @atomicservice 699 * @since 14 700 */ 701 marginLeft: number; 702 703 /** 704 * Number of the scaling. 705 * 706 * @type { ?number } 707 * @syscap SystemCapability.Web.Webview.Core 708 * @atomicservice 709 * @since 14 710 */ 711 scale?: number; 712 713 /** 714 * Whether background should be printed when creating pdf. 715 * 716 * @type { ?boolean } 717 * @syscap SystemCapability.Web.Webview.Core 718 * @atomicservice 719 * @since 14 720 */ 721 shouldPrintBackground?: boolean; 722 } 723 724 /** 725 * Provides basic information of web storage. 726 * 727 * @interface WebStorageOrigin 728 * @syscap SystemCapability.Web.Webview.Core 729 * @since 9 730 */ 731 /** 732 * Provides basic information of web storage. 733 * 734 * @interface WebStorageOrigin 735 * @syscap SystemCapability.Web.Webview.Core 736 * @atomicservice 737 * @since 11 738 */ 739 /** 740 * Provides basic information of web storage. 741 * 742 * @typedef WebStorageOrigin 743 * @syscap SystemCapability.Web.Webview.Core 744 * @atomicservice 745 * @since 12 746 */ 747 /** 748 * Provides basic information of web storage. 749 * 750 * @typedef WebStorageOrigin 751 * @syscap SystemCapability.Web.Webview.Core 752 * @crossplatform 753 * @atomicservice 754 * @since 18 755 */ 756 interface WebStorageOrigin { 757 /** 758 * Url source. 759 * 760 * @syscap SystemCapability.Web.Webview.Core 761 * @since 9 762 */ 763 /** 764 * Url source. 765 * 766 * @type { string } 767 * @syscap SystemCapability.Web.Webview.Core 768 * @atomicservice 769 * @since 11 770 */ 771 /** 772 * Url source. 773 * 774 * @type { string } 775 * @syscap SystemCapability.Web.Webview.Core 776 * @crossplatform 777 * @atomicservice 778 * @since 18 779 */ 780 origin: string; 781 /** 782 * Specify the amount of storage for the source. 783 * 784 * @syscap SystemCapability.Web.Webview.Core 785 * @since 9 786 */ 787 /** 788 * Specify the amount of storage for the source. 789 * 790 * @type { number } 791 * @syscap SystemCapability.Web.Webview.Core 792 * @atomicservice 793 * @since 11 794 */ 795 /** 796 * Specify the amount of storage for the source. 797 * 798 * @type { number } 799 * @syscap SystemCapability.Web.Webview.Core 800 * @crossplatform 801 * @atomicservice 802 * @since 18 803 */ 804 usage: number; 805 /** 806 * the callback of getOriginUsage. 807 * 808 * @syscap SystemCapability.Web.Webview.Core 809 * @since 9 810 */ 811 /** 812 * the callback of getOriginUsage. 813 * 814 * @type { number } 815 * @syscap SystemCapability.Web.Webview.Core 816 * @atomicservice 817 * @since 11 818 */ 819 /** 820 * the callback of getOriginUsage. 821 * 822 * @type { number } 823 * @syscap SystemCapability.Web.Webview.Core 824 * @crossplatform 825 * @atomicservice 826 * @since 18 827 */ 828 quota: number; 829 } 830 831 /** 832 * Defines the Web's request info. 833 * 834 * @typedef RequestInfo 835 * @syscap SystemCapability.Web.Webview.Core 836 * @atomicservice 837 * @since 12 838 */ 839 interface RequestInfo { 840 /** 841 * Gets the url of the request. 842 * @type { string } 843 * @syscap SystemCapability.Web.Webview.Core 844 * @atomicservice 845 * @since 12 846 */ 847 url: string; 848 849 /** 850 * Gets the method of the request. 851 * @type { string } 852 * @syscap SystemCapability.Web.Webview.Core 853 * @atomicservice 854 * @since 12 855 */ 856 method: string; 857 858 /** 859 * Gets the form data of the request. 860 * @type { string } 861 * @syscap SystemCapability.Web.Webview.Core 862 * @atomicservice 863 * @since 12 864 */ 865 formData: string; 866 } 867 868 /** 869 * Defines the scroll offset of the webpage in view port, the unit is virtual pixel. 870 * Related to {@link getScrollOffset} method. 871 * 872 * @typedef ScrollOffset 873 * @syscap SystemCapability.Web.Webview.Core 874 * @atomicservice 875 * @since 13 876 */ 877 interface ScrollOffset { 878 /** 879 * Get the horizontal offset. 880 * @type { number } 881 * @syscap SystemCapability.Web.Webview.Core 882 * @atomicservice 883 * @since 13 884 */ 885 x: number; 886 887 /** 888 * Get the vertical offset. 889 * @type { number } 890 * @syscap SystemCapability.Web.Webview.Core 891 * @atomicservice 892 * @since 13 893 */ 894 y: number; 895 } 896 897 /** 898 * Subscribe to a callback of a specified type of web event once. 899 * 900 * @param {string} type Types of web event. 901 * @param {Callback<void>} callback Indicate callback used to receive the web event. 902 * 903 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 904 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 905 * @syscap SystemCapability.Web.Webview.Core 906 * @since 9 907 */ 908 /** 909 * Subscribe to a callback of a specified type of web event once. 910 * 911 * @param {string} type Types of web event. 912 * @param {Callback<void>} callback Indicate callback used to receive the web event. 913 * 914 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 915 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 916 * @syscap SystemCapability.Web.Webview.Core 917 * @atomicservice 918 * @since 11 919 */ 920 function once(type: string, callback: Callback<void>): void; 921 922 /** 923 * Provides methods for managing web storage.3 924 * 925 * @syscap SystemCapability.Web.Webview.Core 926 * @since 9 927 */ 928 /** 929 * Provides methods for managing web storage.3 930 * 931 * @syscap SystemCapability.Web.Webview.Core 932 * @atomicservice 933 * @since 11 934 */ 935 /** 936 * Provides methods for managing web storage.3 937 * 938 * @syscap SystemCapability.Web.Webview.Core 939 * @crossplatform 940 * @atomicservice 941 * @since 18 942 */ 943 class WebStorage { 944 /** 945 * Delete all the storage data. 946 * 947 * @syscap SystemCapability.Web.Webview.Core 948 * @since 9 949 */ 950 /** 951 * Delete all the storage data. 952 * 953 * @param { boolean } incognito - {@code true} delete all the storage data in incognito mode; 954 * {@code false} otherwise. 955 * @syscap SystemCapability.Web.Webview.Core 956 * @atomicservice 957 * @since 11 958 */ 959 /** 960 * Delete all the storage data. 961 * 962 * @param { boolean } incognito - {@code true} delete all the storage data in incognito mode; 963 * {@code false} otherwise. 964 * @syscap SystemCapability.Web.Webview.Core 965 * @crossplatform 966 * @atomicservice 967 * @since 18 968 */ 969 static deleteAllData(incognito?: boolean): void; 970 971 /** 972 * Delete the storage data with the origin. 973 * 974 * @param { string } origin - The origin which to be deleted. 975 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 976 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 977 * @throws { BusinessError } 17100011 - Invalid origin. 978 * @syscap SystemCapability.Web.Webview.Core 979 * @since 9 980 */ 981 /** 982 * Delete the storage data with the origin. 983 * 984 * @param { string } origin - The origin which to be deleted. 985 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 986 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 987 * @throws { BusinessError } 17100011 - Invalid origin. 988 * @syscap SystemCapability.Web.Webview.Core 989 * @atomicservice 990 * @since 11 991 */ 992 /** 993 * Delete the storage data with the origin. 994 * 995 * @param { string } origin - The origin which to be deleted. 996 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 997 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 998 * @throws { BusinessError } 17100011 - Invalid origin. 999 * @syscap SystemCapability.Web.Webview.Core 1000 * @crossplatform 1001 * @atomicservice 1002 * @since 18 1003 */ 1004 static deleteOrigin(origin: string): void; 1005 1006 /** 1007 * Get current all the web storage origins. 1008 * @returns { Promise<Array<WebStorageOrigin>> } - returns all the WebStorageOrigin. 1009 * @throws { BusinessError } 401 - Invalid input parameter. 1010 * @throws { BusinessError } 17100012 - Invalid web storage origin. 1011 * @syscap SystemCapability.Web.Webview.Core 1012 * @since 9 1013 */ 1014 /** 1015 * Get current all the web storage origins. 1016 * @returns { Promise<Array<WebStorageOrigin>> } - returns all the WebStorageOrigin. 1017 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1018 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 1019 * @throws { BusinessError } 17100012 - Invalid web storage origin. 1020 * @syscap SystemCapability.Web.Webview.Core 1021 * @atomicservice 1022 * @since 11 1023 */ 1024 /** 1025 * Get current all the web storage origins. 1026 * @returns { Promise<Array<WebStorageOrigin>> } - returns all the WebStorageOrigin. 1027 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1028 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 1029 * @throws { BusinessError } 17100012 - Invalid web storage origin. 1030 * @syscap SystemCapability.Web.Webview.Core 1031 * @crossplatform 1032 * @atomicservice 1033 * @since 18 1034 */ 1035 static getOrigins(): Promise<Array<WebStorageOrigin>>; 1036 1037 /** 1038 * Get current all the web storage origins. 1039 * @param { AsyncCallback<Array<WebStorageOrigin>> } callback - callback used to return all the WebStorageOrigin. 1040 * @throws { BusinessError } 401 - Invalid input parameter. 1041 * @throws { BusinessError } 17100012 - Invalid web storage origin. 1042 * @syscap SystemCapability.Web.Webview.Core 1043 * @since 9 1044 */ 1045 /** 1046 * Get current all the web storage origins. 1047 * @param { AsyncCallback<Array<WebStorageOrigin>> } callback - callback used to return all the WebStorageOrigin. 1048 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1049 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 1050 * @throws { BusinessError } 17100012 - Invalid web storage origin. 1051 * @syscap SystemCapability.Web.Webview.Core 1052 * @atomicservice 1053 * @since 11 1054 */ 1055 /** 1056 * Get current all the web storage origins. 1057 * @param { AsyncCallback<Array<WebStorageOrigin>> } callback - callback used to return all the WebStorageOrigin. 1058 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1059 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 1060 * @throws { BusinessError } 17100012 - Invalid web storage origin. 1061 * @syscap SystemCapability.Web.Webview.Core 1062 * @crossplatform 1063 * @atomicservice 1064 * @since 18 1065 */ 1066 static getOrigins(callback: AsyncCallback<Array<WebStorageOrigin>>): void; 1067 1068 /** 1069 * Get the web storage quota with the origin. 1070 * @param { string } origin - The origin which to be inquired. 1071 * @returns { Promise<number> } - the promise returned by the function 1072 * @throws { BusinessError } 401 - Invalid input parameter. 1073 * @throws { BusinessError } 17100011 - Invalid origin. 1074 * @syscap SystemCapability.Web.Webview.Core 1075 * @since 9 1076 */ 1077 /** 1078 * Get the web storage quota with the origin. 1079 * @param { string } origin - The origin which to be inquired. 1080 * @returns { Promise<number> } - the promise returned by the function 1081 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1082 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 1083 * @throws { BusinessError } 17100011 - Invalid origin. 1084 * @syscap SystemCapability.Web.Webview.Core 1085 * @atomicservice 1086 * @since 11 1087 */ 1088 /** 1089 * Get the web storage quota with the origin. 1090 * @param { string } origin - The origin which to be inquired. 1091 * @returns { Promise<number> } - the promise returned by the function 1092 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1093 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 1094 * @throws { BusinessError } 17100011 - Invalid origin. 1095 * @syscap SystemCapability.Web.Webview.Core 1096 * @crossplatform 1097 * @atomicservice 1098 * @since 18 1099 */ 1100 static getOriginQuota(origin: string): Promise<number>; 1101 1102 /** 1103 * Get the web storage quota with the origin. 1104 * @param { string } origin - The origin which to be inquired. 1105 * @param { AsyncCallback<number> } callback - the callback of getOriginQuota. 1106 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1107 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 1108 * @throws { BusinessError } 17100011 - Invalid origin. 1109 * @syscap SystemCapability.Web.Webview.Core 1110 * @since 9 1111 */ 1112 /** 1113 * Get the web storage quota with the origin. 1114 * @param { string } origin - The origin which to be inquired. 1115 * @param { AsyncCallback<number> } callback - the callback of getOriginQuota. 1116 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1117 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 1118 * @throws { BusinessError } 17100011 - Invalid origin. 1119 * @syscap SystemCapability.Web.Webview.Core 1120 * @atomicservice 1121 * @since 11 1122 */ 1123 /** 1124 * Get the web storage quota with the origin. 1125 * @param { string } origin - The origin which to be inquired. 1126 * @param { AsyncCallback<number> } callback - the callback of getOriginQuota. 1127 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1128 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 1129 * @throws { BusinessError } 17100011 - Invalid origin. 1130 * @syscap SystemCapability.Web.Webview.Core 1131 * @crossplatform 1132 * @atomicservice 1133 * @since 18 1134 */ 1135 static getOriginQuota(origin: string, callback: AsyncCallback<number>): void; 1136 1137 /** 1138 * Get the web amount of storage with the origin. 1139 * @param { string } origin - The origin which to be inquired. 1140 * @returns { Promise<number> } - the promise returned by the function 1141 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1142 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 1143 * @throws { BusinessError } 17100011 - Invalid origin. 1144 * @syscap SystemCapability.Web.Webview.Core 1145 * @since 9 1146 */ 1147 /** 1148 * Get the web amount of storage with the origin. 1149 * @param { string } origin - The origin which to be inquired. 1150 * @returns { Promise<number> } - the promise returned by the function 1151 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1152 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 1153 * @throws { BusinessError } 17100011 - Invalid origin. 1154 * @syscap SystemCapability.Web.Webview.Core 1155 * @atomicservice 1156 * @since 11 1157 */ 1158 /** 1159 * Get the web amount of storage with the origin. 1160 * @param { string } origin - The origin which to be inquired. 1161 * @returns { Promise<number> } - the promise returned by the function 1162 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1163 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 1164 * @throws { BusinessError } 17100011 - Invalid origin. 1165 * @syscap SystemCapability.Web.Webview.Core 1166 * @crossplatform 1167 * @atomicservice 1168 * @since 18 1169 */ 1170 static getOriginUsage(origin: string): Promise<number>; 1171 1172 /** 1173 * Get the web amount of storage with the origin. 1174 * @param { string } origin - The origin which to be inquired. 1175 * @param { AsyncCallback<number> } callback - the callback of getOriginUsage. 1176 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1177 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 1178 * @throws { BusinessError } 17100011 - Invalid origin. 1179 * @syscap SystemCapability.Web.Webview.Core 1180 * @since 9 1181 */ 1182 /** 1183 * Get the web amount of storage with the origin. 1184 * @param { string } origin - The origin which to be inquired. 1185 * @param { AsyncCallback<number> } callback - the callback of getOriginUsage. 1186 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1187 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 1188 * @throws { BusinessError } 17100011 - Invalid origin. 1189 * @syscap SystemCapability.Web.Webview.Core 1190 * @atomicservice 1191 * @since 11 1192 */ 1193 /** 1194 * Get the web amount of storage with the origin. 1195 * @param { string } origin - The origin which to be inquired. 1196 * @param { AsyncCallback<number> } callback - the callback of getOriginUsage. 1197 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1198 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 1199 * @throws { BusinessError } 17100011 - Invalid origin. 1200 * @syscap SystemCapability.Web.Webview.Core 1201 * @crossplatform 1202 * @atomicservice 1203 * @since 18 1204 */ 1205 static getOriginUsage(origin: string, callback: AsyncCallback<number>): void; 1206 } 1207 1208 /** 1209 * Provides methods for managing web database. 1210 * @syscap SystemCapability.Web.Webview.Core 1211 * @since 9 1212 */ 1213 /** 1214 * Provides methods for managing web database. 1215 * @syscap SystemCapability.Web.Webview.Core 1216 * @crossplatform 1217 * @atomicservice 1218 * @since 11 1219 */ 1220 class WebDataBase { 1221 /** 1222 * Get whether instances holds any http authentication credentials. 1223 * @returns { boolean } true if instances saved any http authentication credentials otherwise false. 1224 * @syscap SystemCapability.Web.Webview.Core 1225 * @since 9 1226 */ 1227 /** 1228 * Get whether instances holds any http authentication credentials. 1229 * @returns { boolean } true if instances saved any http authentication credentials otherwise false. 1230 * @syscap SystemCapability.Web.Webview.Core 1231 * @crossplatform 1232 * @atomicservice 1233 * @since 11 1234 */ 1235 static existHttpAuthCredentials(): boolean; 1236 1237 /** 1238 * Delete all http authentication credentials. 1239 * 1240 * @syscap SystemCapability.Web.Webview.Core 1241 * @since 9 1242 */ 1243 /** 1244 * Delete all http authentication credentials. 1245 * 1246 * @syscap SystemCapability.Web.Webview.Core 1247 * @crossplatform 1248 * @atomicservice 1249 * @since 11 1250 */ 1251 static deleteHttpAuthCredentials(): void; 1252 1253 /** 1254 * Get http authentication credentials. 1255 * @param { string } host - The host to which the credentials apply. 1256 * @param { string } realm - The realm to which the credentials apply. 1257 * @returns { Array<string> } Return an array containing username and password. 1258 * @throws { BusinessError } 401 - Invalid input parameter. 1259 * @syscap SystemCapability.Web.Webview.Core 1260 * @since 9 1261 */ 1262 /** 1263 * Get http authentication credentials. 1264 * @param { string } host - The host to which the credentials apply. 1265 * @param { string } realm - The realm to which the credentials apply. 1266 * @returns { Array<string> } Return an array containing username and password. 1267 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1268 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 1269 * @syscap SystemCapability.Web.Webview.Core 1270 * @crossplatform 1271 * @atomicservice 1272 * @since 11 1273 */ 1274 static getHttpAuthCredentials(host: string, realm: string): Array<string>; 1275 1276 /** 1277 * Save http authentication credentials. 1278 * @param { string } host - The host to which the credentials apply. 1279 * @param { string } realm - The realm to which the credentials apply. 1280 * @param { string } username - The username. 1281 * @param { string } password - The password. 1282 * @throws { BusinessError } 401 - Invalid input parameter. 1283 * @syscap SystemCapability.Web.Webview.Core 1284 * @since 9 1285 */ 1286 /** 1287 * Save http authentication credentials. 1288 * @param { string } host - The host to which the credentials apply. 1289 * @param { string } realm - The realm to which the credentials apply. 1290 * @param { string } username - The username. 1291 * @param { string } password - The password. 1292 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1293 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 1294 * @syscap SystemCapability.Web.Webview.Core 1295 * @crossplatform 1296 * @atomicservice 1297 * @since 11 1298 */ 1299 static saveHttpAuthCredentials(host: string, realm: string, username: string, password: string): void; 1300 } 1301 1302 /** 1303 * Provides a method for managing web geographic location permissions. 1304 * @syscap SystemCapability.Web.Webview.Core 1305 * @since 9 1306 */ 1307 /** 1308 * Provides a method for managing web geographic location permissions. 1309 * @syscap SystemCapability.Web.Webview.Core 1310 * @atomicservice 1311 * @since 11 1312 */ 1313 /** 1314 * Provides a method for managing web geographic location permissions. 1315 * @syscap SystemCapability.Web.Webview.Core 1316 * @crossplatform 1317 * @atomicservice 1318 * @since 18 1319 */ 1320 class GeolocationPermissions { 1321 /** 1322 * Allow geolocation permissions for specifies source. 1323 * @param { string } origin - Url source. 1324 * @throws { BusinessError } 401 - Invalid input parameter. 1325 * @throws { BusinessError } 17100011 - Invalid origin. 1326 * @syscap SystemCapability.Web.Webview.Core 1327 * @since 9 1328 */ 1329 /** 1330 * Allow geolocation permissions for specifies source. 1331 * @param { string } origin - Url source. 1332 * @param { boolean } incognito - {@code true} Allow geolocation permissions for specifies source 1333 * in incognito mode; {@code false} otherwise. 1334 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1335 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 1336 * @throws { BusinessError } 17100011 - Invalid origin. 1337 * @syscap SystemCapability.Web.Webview.Core 1338 * @atomicservice 1339 * @since 11 1340 */ 1341 /** 1342 * Allow geolocation permissions for specifies source. 1343 * @param { string } origin - Url source. 1344 * @param { boolean } incognito - {@code true} Allow geolocation permissions for specifies source 1345 * in incognito mode; {@code false} otherwise. 1346 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1347 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 1348 * @throws { BusinessError } 17100011 - Invalid origin. 1349 * @syscap SystemCapability.Web.Webview.Core 1350 * @crossplatform 1351 * @atomicservice 1352 * @since 18 1353 */ 1354 static allowGeolocation(origin: string, incognito?: boolean): void; 1355 1356 /** 1357 * Delete geolocation permissions for specifies source. 1358 * @param { string } origin - Url source. 1359 * @throws { BusinessError } 401 - Invalid input parameter. 1360 * @throws { BusinessError } 17100011 - Invalid origin. 1361 * @syscap SystemCapability.Web.Webview.Core 1362 * @since 9 1363 */ 1364 /** 1365 * Delete geolocation permissions for specifies source. 1366 * @param { string } origin - Url source. 1367 * @param { boolean } incognito - {@code true} delete geolocation permissions for specifies source 1368 * in incognito mode; {@code false} otherwise. 1369 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1370 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 1371 * @throws { BusinessError } 17100011 - Invalid origin. 1372 * @syscap SystemCapability.Web.Webview.Core 1373 * @atomicservice 1374 * @since 11 1375 */ 1376 /** 1377 * Delete geolocation permissions for specifies source. 1378 * @param { string } origin - Url source. 1379 * @param { boolean } incognito - {@code true} delete geolocation permissions for specifies source 1380 * in incognito mode; {@code false} otherwise. 1381 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1382 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 1383 * @throws { BusinessError } 17100011 - Invalid origin. 1384 * @syscap SystemCapability.Web.Webview.Core 1385 * @crossplatform 1386 * @atomicservice 1387 * @since 18 1388 */ 1389 static deleteGeolocation(origin: string, incognito?: boolean): void; 1390 1391 /** 1392 * Delete all geolocation permissions. 1393 * 1394 * @syscap SystemCapability.Web.Webview.Core 1395 * @since 9 1396 */ 1397 /** 1398 * Delete all geolocation permissions. 1399 * 1400 * @param { boolean } incognito - {@code true} delete all geolocation in incognito mode; 1401 * {@code false} otherwise. 1402 * @syscap SystemCapability.Web.Webview.Core 1403 * @atomicservice 1404 * @since 11 1405 */ 1406 /** 1407 * Delete all geolocation permissions. 1408 * 1409 * @param { boolean } incognito - {@code true} delete all geolocation in incognito mode; 1410 * {@code false} otherwise. 1411 * @syscap SystemCapability.Web.Webview.Core 1412 * @crossplatform 1413 * @atomicservice 1414 * @since 18 1415 */ 1416 static deleteAllGeolocation(incognito?: boolean): void; 1417 1418 /** 1419 * Gets the geolocation permission status of the specified source. 1420 * @param { string } origin - Url source. 1421 * @returns { Promise<boolean> } A Promise instance that obtains the permission 1422 * status of the specified source and obtains successfully, 1423 * true for authorization, false for access denial. Failed 1424 * to get, indicating that the permission status of the 1425 * specified source does not exist. 1426 * @throws { BusinessError } 401 - Invalid input parameter. 1427 * @throws { BusinessError } 17100011 - Invalid origin. 1428 * @syscap SystemCapability.Web.Webview.Core 1429 * @since 9 1430 */ 1431 /** 1432 * Gets the geolocation permission status of the specified source. 1433 * @param { string } origin - Url source. 1434 * @param { boolean } incognito - {@code true} gets the geolocation permission status of the 1435 * specified source in incognito mode; {@code false} otherwise. 1436 * @returns { Promise<boolean> } A Promise instance that obtains the permission 1437 * status of the specified source and obtains successfully, 1438 * true for authorization, false for access denial. Failed 1439 * to get, indicating that the permission status of the 1440 * specified source does not exist. 1441 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1442 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 1443 * @throws { BusinessError } 17100011 - Invalid origin. 1444 * @syscap SystemCapability.Web.Webview.Core 1445 * @atomicservice 1446 * @since 11 1447 */ 1448 /** 1449 * Gets the geolocation permission status of the specified source. 1450 * @param { string } origin - Url source. 1451 * @param { boolean } incognito - {@code true} gets the geolocation permission status of the 1452 * specified source in incognito mode; {@code false} otherwise. 1453 * @returns { Promise<boolean> } A Promise instance that obtains the permission 1454 * status of the specified source and obtains successfully, 1455 * true for authorization, false for access denial. Failed 1456 * to get, indicating that the permission status of the 1457 * specified source does not exist. 1458 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1459 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 1460 * @throws { BusinessError } 17100011 - Invalid origin. 1461 * @syscap SystemCapability.Web.Webview.Core 1462 * @crossplatform 1463 * @atomicservice 1464 * @since 18 1465 */ 1466 static getAccessibleGeolocation(origin: string, incognito?: boolean): Promise<boolean>; 1467 1468 /** 1469 * Gets the geolocation permission status of the specified source. 1470 * @param { string } origin - Url source. 1471 * @param { AsyncCallback<boolean> } callback - Returns the geolocation permission status for 1472 * the specified source. Successful acquisition, 1473 * true means authorized, false means access is 1474 * denied. Failed to get, indicating that the 1475 * permission status of the specified source does 1476 * not exist. 1477 * @throws { BusinessError } 401 - Invalid input parameter. 1478 * @throws { BusinessError } 17100011 - Invalid origin. 1479 * @syscap SystemCapability.Web.Webview.Core 1480 * @since 9 1481 */ 1482 /** 1483 * Gets the geolocation permission status of the specified source. 1484 * @param { string } origin - Url source. 1485 * @param { AsyncCallback<boolean> } callback - Returns the geolocation permission status for 1486 * the specified source. Successful acquisition, 1487 * true means authorized, false means access is 1488 * denied. Failed to get, indicating that the 1489 * permission status of the specified source does 1490 * not exist. 1491 * @param { boolean } incognito - {@code true} gets the geolocation permission status of the 1492 * specified source in incognito mode; {@code false} otherwise. 1493 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1494 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 1495 * @throws { BusinessError } 17100011 - Invalid origin. 1496 * @syscap SystemCapability.Web.Webview.Core 1497 * @atomicservice 1498 * @since 11 1499 */ 1500 /** 1501 * Gets the geolocation permission status of the specified source. 1502 * @param { string } origin - Url source. 1503 * @param { AsyncCallback<boolean> } callback - Returns the geolocation permission status for 1504 * the specified source. Successful acquisition, 1505 * true means authorized, false means access is 1506 * denied. Failed to get, indicating that the 1507 * permission status of the specified source does 1508 * not exist. 1509 * @param { boolean } incognito - {@code true} gets the geolocation permission status of the 1510 * specified source in incognito mode; {@code false} otherwise. 1511 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1512 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 1513 * @throws { BusinessError } 17100011 - Invalid origin. 1514 * @syscap SystemCapability.Web.Webview.Core 1515 * @crossplatform 1516 * @atomicservice 1517 * @since 18 1518 */ 1519 static getAccessibleGeolocation(origin: string, callback: AsyncCallback<boolean>, incognito?: boolean): void; 1520 1521 /** 1522 * Get all stored geolocation permission url source. 1523 * 1524 * @returns { Promise<Array<string>> } A Promise instance that gets all source information about 1525 * the stored geolocation permission state. 1526 * @throws { BusinessError } 401 - Invalid input parameter. 1527 * @syscap SystemCapability.Web.Webview.Core 1528 * @since 9 1529 */ 1530 /** 1531 * Get all stored geolocation permission url source. 1532 * @param { boolean } incognito - {@code true} get all stored geolocation permission url source 1533 * in incognito mode; {@code false} otherwise. 1534 * @returns { Promise<Array<string>> } A Promise instance that gets all source information about 1535 * the stored geolocation permission state. 1536 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1537 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 1538 * @syscap SystemCapability.Web.Webview.Core 1539 * @atomicservice 1540 * @since 11 1541 */ 1542 /** 1543 * Get all stored geolocation permission url source. 1544 * @param { boolean } incognito - {@code true} get all stored geolocation permission url source 1545 * in incognito mode; {@code false} otherwise. 1546 * @returns { Promise<Array<string>> } A Promise instance that gets all source information about 1547 * the stored geolocation permission state. 1548 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1549 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 1550 * @syscap SystemCapability.Web.Webview.Core 1551 * @crossplatform 1552 * @atomicservice 1553 * @since 18 1554 */ 1555 static getStoredGeolocation(incognito?: boolean): Promise<Array<string>>; 1556 1557 /** 1558 * Get all stored geolocation permission url source. 1559 * @param { AsyncCallback<Array<string>> } callback - Returns all source information for 1560 * stored geolocation permission states. 1561 * @throws { BusinessError } 401 - Invalid input parameter. 1562 * @syscap SystemCapability.Web.Webview.Core 1563 * @since 9 1564 */ 1565 /** 1566 * Get all stored geolocation permission url source. 1567 * @param { AsyncCallback<Array<string>> } callback - Returns all source information for 1568 * stored geolocation permission states. 1569 * @param { boolean } incognito - {@code true} gets all stored geolocation permission url 1570 * source in incognito mode; {@code false} otherwise. 1571 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1572 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 1573 * @syscap SystemCapability.Web.Webview.Core 1574 * @atomicservice 1575 * @since 11 1576 */ 1577 /** 1578 * Get all stored geolocation permission url source. 1579 * @param { AsyncCallback<Array<string>> } callback - Returns all source information for 1580 * stored geolocation permission states. 1581 * @param { boolean } incognito - {@code true} gets all stored geolocation permission url 1582 * source in incognito mode; {@code false} otherwise. 1583 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1584 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 1585 * @syscap SystemCapability.Web.Webview.Core 1586 * @crossplatform 1587 * @atomicservice 1588 * @since 18 1589 */ 1590 static getStoredGeolocation(callback: AsyncCallback<Array<string>>, incognito?: boolean): void; 1591 } 1592 1593 /** 1594 * Provides methods for managing the web cookies. 1595 * 1596 * @syscap SystemCapability.Web.Webview.Core 1597 * @since 9 1598 */ 1599 /** 1600 * Provides methods for managing the web cookies. 1601 * 1602 * @syscap SystemCapability.Web.Webview.Core 1603 * @crossplatform 1604 * @atomicservice 1605 * @since 11 1606 */ 1607 class WebCookieManager { 1608 /** 1609 * Gets all cookies for the given URL. 1610 * 1611 * @param { string } url - The URL for which the cookies are requested. 1612 * @returns { string } - The cookie value for the given URL. 1613 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1614 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 1615 * @throws { BusinessError } 17100002 - Invalid url. 1616 * @syscap SystemCapability.Web.Webview.Core 1617 * @since 9 1618 * @deprecated since 11 1619 * @useinstead ohos.web.webview.WebCookieManager#fetchCookieSync 1620 */ 1621 static getCookie(url: string): string; 1622 1623 /** 1624 * Gets all cookies for the given URL. 1625 * 1626 * @param { string } url - The URL for which the cookies are requested. 1627 * @param { boolean } incognito - {@code true} gets all cookies for the given URL 1628 * in incognito mode; {@code false} otherwise. 1629 * @returns { string } - The cookie value for the given URL. 1630 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1631 * <br>2. Incorrect parameter types. 1632 * @throws { BusinessError } 17100002 - Invalid url. 1633 * @syscap SystemCapability.Web.Webview.Core 1634 * @atomicservice 1635 * @since 11 1636 */ 1637 static fetchCookieSync(url: string, incognito?: boolean): string; 1638 1639 /** 1640 * Gets all cookies for the given URL Asynchronously. 1641 * 1642 * @param { string } url - The URL for which the cookies are requested. 1643 * @returns { Promise<string> } - A promise resolved after the cookies of given URL have been gotten. 1644 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1645 * <br>2. Incorrect parameter types. 1646 * @throws { BusinessError } 17100002 - Invalid url. 1647 * @syscap SystemCapability.Web.Webview.Core 1648 * @crossplatform 1649 * @atomicservice 1650 * @since 11 1651 */ 1652 static fetchCookie(url: string): Promise<string>; 1653 1654 /** 1655 * Gets all cookies for the given URL Asynchronously. 1656 * 1657 * @param { string } url - The URL for which the cookies are requested. 1658 * @param { boolean } incognito - {@code true} gets all cookies for the given URL 1659 * in incognito mode; {@code false} otherwise. 1660 * @returns { Promise<string> } - A promise resolved after the cookies of given URL have been gotten. 1661 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1662 * <br>2. Incorrect parameter types. 1663 * @throws { BusinessError } 17100002 - Invalid url. 1664 * @syscap SystemCapability.Web.Webview.Core 1665 * @since 14 1666 */ 1667 static fetchCookie(url: string, incognito: boolean): Promise<string>; 1668 1669 /** 1670 * Gets all cookies for the given URL Asynchronously. 1671 * 1672 * @param { string } url - The URL for which the cookies are requested. 1673 * @param { AsyncCallback<string> } callback - Called after the cookies of given URL have been gotten. 1674 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1675 * <br>2. Incorrect parameter types. 1676 * @throws { BusinessError } 17100002 - Invalid url. 1677 * @syscap SystemCapability.Web.Webview.Core 1678 * @crossplatform 1679 * @atomicservice 1680 * @since 11 1681 */ 1682 static fetchCookie(url: string, callback: AsyncCallback<string>): void; 1683 1684 /** 1685 * Set a single cookie (key-value pair) for the given URL. 1686 * 1687 * @param { string } url - The URL for which the cookie is to be set. 1688 * @param { string } value - The cookie as a string, using the format of the 'Set-Cookie' HTTP response header. 1689 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1690 * <br>2. Incorrect parameter types. 1691 * @throws { BusinessError } 17100002 - Invalid url. 1692 * @throws { BusinessError } 17100005 - Invalid cookie value. 1693 * @syscap SystemCapability.Web.Webview.Core 1694 * @since 9 1695 * @deprecated since 11 1696 * @useinstead ohos.web.webview.WebCookieManager#configCookieSync 1697 */ 1698 static setCookie(url: string, value: string): void; 1699 1700 /** 1701 * Set a single cookie (key-value pair) for the given URL. 1702 * 1703 * @param { string } url - The URL for which the cookie is to be set. 1704 * @param { string } value - The cookie as a string, using the format of the 'Set-Cookie' HTTP response header. 1705 * @param { boolean } incognito - {@code true} set a single cookie (key-value pair) for the given URL 1706 * in incognito mode; {@code false} otherwise. 1707 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1708 * <br>2. Incorrect parameter types. 1709 * @throws { BusinessError } 17100002 - Invalid url. 1710 * @throws { BusinessError } 17100005 - Invalid cookie value. 1711 * @syscap SystemCapability.Web.Webview.Core 1712 * @atomicservice 1713 * @since 11 1714 */ 1715 static configCookieSync(url: string, value: string, incognito?: boolean): void; 1716 1717 /** 1718 * Set a single cookie (key-value pair) for the given URL. 1719 * 1720 * @param { string } url - The URL for which the cookie is to be set. 1721 * @param { string } value - The cookie as a string, using the format of the 'Set-Cookie' HTTP response header. 1722 * @param { boolean } incognito - {@code true} set a single cookie (key-value pair) for the given URL 1723 * in incognito mode; {@code false} otherwise. 1724 * @param { boolean } includeHttpOnly - {@code true} HTTP-only cookies can also be overwritten; 1725 * {@code false} otherwise. 1726 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1727 * <br>2. Incorrect parameter types. 1728 * @throws { BusinessError } 17100002 - Invalid url. 1729 * @throws { BusinessError } 17100005 - Invalid cookie value. 1730 * @syscap SystemCapability.Web.Webview.Core 1731 * @since 14 1732 */ 1733 static configCookieSync(url: string, value: string, incognito: boolean, includeHttpOnly: boolean): void; 1734 1735 /** 1736 * Set a single cookie (key-value pair) for the given URL Asynchronously. 1737 * 1738 * @param { string } url - The URL for which the cookie is to be set. 1739 * @param { string } value - The cookie as a string, using the format of the 'Set-Cookie' HTTP response header. 1740 * @returns { Promise<void> } - A promise resolved after the cookies of given URL have been set. 1741 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1742 * <br>2. Incorrect parameter types. 1743 * @throws { BusinessError } 17100002 - Invalid url. 1744 * @throws { BusinessError } 17100005 - Invalid cookie value. 1745 * @syscap SystemCapability.Web.Webview.Core 1746 * @crossplatform 1747 * @atomicservice 1748 * @since 11 1749 */ 1750 static configCookie(url: string, value: string): Promise<void>; 1751 1752 /** 1753 * Set a single cookie (key-value pair) for the given URL Asynchronously. 1754 * 1755 * @param { string } url - The URL for which the cookie is to be set. 1756 * @param { string } value - The cookie as a string, using the format of the 'Set-Cookie' HTTP response header. 1757 * @param { boolean } incognito - {@code true} set a single cookie (key-value pair) for the given URL 1758 * in incognito mode; {@code false} otherwise. 1759 * @param { boolean } includeHttpOnly - {@code true} HTTP-only cookies can also be overwritten; 1760 * {@code false} otherwise. 1761 * @returns { Promise<void> } - A promise resolved after the cookies of given URL have been set. 1762 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1763 * <br>2. Incorrect parameter types. 1764 * @throws { BusinessError } 17100002 - Invalid url. 1765 * @throws { BusinessError } 17100005 - Invalid cookie value. 1766 * @syscap SystemCapability.Web.Webview.Core 1767 * @since 14 1768 */ 1769 static configCookie(url: string, value: string, incognito: boolean, includeHttpOnly: boolean): Promise<void>; 1770 1771 /** 1772 * Set a single cookie (key-value pair) for the given URL Asynchronously. 1773 * 1774 * @param { string } url - The URL for which the cookie is to be set. 1775 * @param { string } value - The cookie as a string, using the format of the 'Set-Cookie' HTTP response header. 1776 * @param { AsyncCallback<void> } callback - Called after the cookies have been set. 1777 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1778 * <br>2. Incorrect parameter types. 1779 * @throws { BusinessError } 17100002 - Invalid url. 1780 * @throws { BusinessError } 17100005 - Invalid cookie value. 1781 * @syscap SystemCapability.Web.Webview.Core 1782 * @crossplatform 1783 * @atomicservice 1784 * @since 11 1785 */ 1786 static configCookie(url: string, value: string, callback: AsyncCallback<void>): void; 1787 1788 /** 1789 * Save the cookies synchronously. 1790 * @syscap SystemCapability.Web.Webview.Core 1791 * @since 15 1792 */ 1793 static saveCookieSync(): void; 1794 1795 /** 1796 * Save the cookies Asynchronously. 1797 * @returns { Promise<void> } - A promise resolved after the cookies have been saved. 1798 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1799 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 1800 * @syscap SystemCapability.Web.Webview.Core 1801 * @since 9 1802 */ 1803 /** 1804 * Save the cookies Asynchronously. 1805 * @returns { Promise<void> } - A promise resolved after the cookies have been saved. 1806 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1807 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 1808 * @syscap SystemCapability.Web.Webview.Core 1809 * @atomicservice 1810 * @since 11 1811 */ 1812 static saveCookieAsync(): Promise<void>; 1813 1814 /** 1815 * Save the cookies Asynchronously. 1816 * @param { AsyncCallback<void> } callback - Called after the cookies have been saved. 1817 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1818 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 1819 * @syscap SystemCapability.Web.Webview.Core 1820 * @since 9 1821 */ 1822 /** 1823 * Save the cookies Asynchronously. 1824 * @param { AsyncCallback<void> } callback - Called after the cookies have been saved. 1825 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1826 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 1827 * @syscap SystemCapability.Web.Webview.Core 1828 * @atomicservice 1829 * @since 11 1830 */ 1831 static saveCookieAsync(callback: AsyncCallback<void>): void; 1832 1833 /** 1834 * Get whether the instance can send and accept cookies. 1835 * 1836 * @returns { boolean } True if the instance can send and accept cookies else false. 1837 * @syscap SystemCapability.Web.Webview.Core 1838 * @since 9 1839 */ 1840 /** 1841 * Get whether the instance can send and accept cookies. 1842 * 1843 * @returns { boolean } True if the instance can send and accept cookies else false. 1844 * @syscap SystemCapability.Web.Webview.Core 1845 * @atomicservice 1846 * @since 11 1847 */ 1848 static isCookieAllowed(): boolean; 1849 1850 /** 1851 * Set whether the instance should send and accept cookies. 1852 * By default this is set to be true. 1853 * 1854 * @param { boolean } accept - Whether the instance should send and accept cookies. 1855 * @throws { BusinessError } 401 - Invalid input parameter. 1856 * @syscap SystemCapability.Web.Webview.Core 1857 * @since 9 1858 */ 1859 /** 1860 * Set whether the instance should send and accept cookies. 1861 * By default this is set to be true. 1862 * 1863 * @param { boolean } accept - Whether the instance should send and accept cookies. 1864 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1865 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 1866 * @syscap SystemCapability.Web.Webview.Core 1867 * @atomicservice 1868 * @since 11 1869 */ 1870 static putAcceptCookieEnabled(accept: boolean): void; 1871 1872 /** 1873 * Get whether the instance can send and accept thirdparty cookies. 1874 * 1875 * @returns { boolean } True if the instance can send and accept thirdparty cookies else false. 1876 * @syscap SystemCapability.Web.Webview.Core 1877 * @since 9 1878 */ 1879 /** 1880 * Get whether the instance can send and accept thirdparty cookies. 1881 * 1882 * @returns { boolean } True if the instance can send and accept thirdparty cookies else false. 1883 * @syscap SystemCapability.Web.Webview.Core 1884 * @atomicservice 1885 * @since 11 1886 */ 1887 static isThirdPartyCookieAllowed(): boolean; 1888 1889 /** 1890 * Set whether the instance should send and accept thirdparty cookies. 1891 * By default this is set to be false. 1892 * 1893 * @param { boolean } accept - Whether the instance should send and accept thirdparty cookies. 1894 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1895 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 1896 * @syscap SystemCapability.Web.Webview.Core 1897 * @since 9 1898 */ 1899 /** 1900 * Set whether the instance should send and accept thirdparty cookies. 1901 * By default this is set to be false. 1902 * 1903 * @param { boolean } accept - Whether the instance should send and accept thirdparty cookies. 1904 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1905 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 1906 * @syscap SystemCapability.Web.Webview.Core 1907 * @atomicservice 1908 * @since 11 1909 */ 1910 static putAcceptThirdPartyCookieEnabled(accept: boolean): void; 1911 1912 /** 1913 * Check whether exists any cookies. 1914 * 1915 * @returns { boolean } True if exists more than one cookie else false; 1916 * @syscap SystemCapability.Web.Webview.Core 1917 * @since 9 1918 */ 1919 /** 1920 * Check whether exists any cookies. 1921 * 1922 * @param { boolean } incognito - {@code true} check whether exists any cookies. 1923 * in incognito mode; {@code false} otherwise. 1924 * @returns { boolean } True if exists more than one cookie else false; 1925 * @syscap SystemCapability.Web.Webview.Core 1926 * @atomicservice 1927 * @since 11 1928 */ 1929 /** 1930 * Check whether exists any cookies. 1931 * 1932 * @param { boolean } incognito - {@code true} check whether exists any cookies. 1933 * in incognito mode; {@code false} otherwise. 1934 * @returns { boolean } True if exists more than one cookie else false; 1935 * @syscap SystemCapability.Web.Webview.Core 1936 * @crossplatform 1937 * @atomicservice 1938 * @since 18 1939 */ 1940 static existCookie(incognito?: boolean): boolean; 1941 1942 /** 1943 * Remove all cookies. 1944 * @syscap SystemCapability.Web.Webview.Core 1945 * @since 9 1946 * @deprecated since 11 1947 * @useinstead ohos.web.webview.WebCookieManager#clearAllCookiesSync 1948 */ 1949 static deleteEntireCookie(): void; 1950 1951 /** 1952 * Remove all cookies. 1953 * 1954 * @param { boolean } incognito - {@code true} remove all cookies in incognito mode; 1955 * {@code false} otherwise. 1956 * @syscap SystemCapability.Web.Webview.Core 1957 * @atomicservice 1958 * @since 11 1959 */ 1960 static clearAllCookiesSync(incognito?: boolean): void; 1961 1962 /** 1963 * Remove all cookies Asynchronously. 1964 * @returns { Promise<void> } - A promise resolved after the cookies have been deleted. 1965 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1966 * @syscap SystemCapability.Web.Webview.Core 1967 * @crossplatform 1968 * @atomicservice 1969 * @since 11 1970 */ 1971 static clearAllCookies(): Promise<void>; 1972 1973 /** 1974 * Remove all cookies Asynchronously. 1975 * @param { AsyncCallback<void> } callback - Called after the cookies have been deleted. 1976 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1977 * <br>2. Incorrect parameter types. 1978 * @syscap SystemCapability.Web.Webview.Core 1979 * @crossplatform 1980 * @atomicservice 1981 * @since 11 1982 */ 1983 static clearAllCookies(callback: AsyncCallback<void>): void; 1984 1985 /** 1986 * Delete the session cookies. 1987 * @syscap SystemCapability.Web.Webview.Core 1988 * @since 9 1989 * @deprecated since 11 1990 * @useinstead ohos.web.webview.WebCookieManager#clearSessionCookieSync 1991 */ 1992 static deleteSessionCookie(): void; 1993 1994 /** 1995 * Delete the session cookies. 1996 * @syscap SystemCapability.Web.Webview.Core 1997 * @atomicservice 1998 * @since 11 1999 */ 2000 static clearSessionCookieSync(): void; 2001 2002 /** 2003 * Delete the session cookies Asynchronously. 2004 * @returns { Promise<void> } - A promise resolved after the cookies have been deleted. 2005 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2006 * @syscap SystemCapability.Web.Webview.Core 2007 * @atomicservice 2008 * @since 11 2009 */ 2010 static clearSessionCookie(): Promise<void>; 2011 2012 /** 2013 * Delete the session cookies Asynchronously. 2014 * @param { AsyncCallback<void> } callback - Called after the cookies have been deleted. 2015 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2016 * <br>2. Incorrect parameter types. 2017 * @syscap SystemCapability.Web.Webview.Core 2018 * @atomicservice 2019 * @since 11 2020 */ 2021 /** 2022 * Delete the session cookies Asynchronously. 2023 * @param { AsyncCallback<void> } callback - Called after the cookies have been deleted. 2024 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2025 * <br>2. Incorrect parameter types. 2026 * @syscap SystemCapability.Web.Webview.Core 2027 * @crossplatform 2028 * @atomicservice 2029 * @since 18 2030 */ 2031 static clearSessionCookie(callback: AsyncCallback<void>): void; 2032 } 2033 2034 /** 2035 * Enum type supplied to {@link onMessageEventExt} for indicating the type of web message. 2036 * 2037 * @enum {number} 2038 * @syscap SystemCapability.Web.Webview.Core 2039 * @since 10 2040 */ 2041 /** 2042 * Enum type supplied to {@link onMessageEventExt} for indicating the type of web message. 2043 * 2044 * @enum {number} 2045 * @syscap SystemCapability.Web.Webview.Core 2046 * @atomicservice 2047 * @since 11 2048 */ 2049 /** 2050 * Enum type supplied to {@link onMessageEventExt} for indicating the type of web message. 2051 * 2052 * @enum {number} 2053 * @syscap SystemCapability.Web.Webview.Core 2054 * @crossplatform 2055 * @atomicservice 2056 * @since 18 2057 */ 2058 enum WebMessageType { 2059 /** 2060 * Unsupported data type. 2061 * 2062 * @syscap SystemCapability.Web.Webview.Core 2063 * @since 10 2064 */ 2065 /** 2066 * Unsupported data type. 2067 * 2068 * @syscap SystemCapability.Web.Webview.Core 2069 * @atomicservice 2070 * @since 11 2071 */ 2072 NOT_SUPPORT, 2073 2074 /** 2075 * The string data type. 2076 * 2077 * @syscap SystemCapability.Web.Webview.Core 2078 * @since 10 2079 */ 2080 /** 2081 * The string data type. 2082 * 2083 * @syscap SystemCapability.Web.Webview.Core 2084 * @atomicservice 2085 * @since 11 2086 */ 2087 /** 2088 * The string data type. 2089 * 2090 * @syscap SystemCapability.Web.Webview.Core 2091 * @crossplatform 2092 * @atomicservice 2093 * @since 18 2094 */ 2095 STRING, 2096 2097 /** 2098 * The number data type. 2099 * 2100 * @syscap SystemCapability.Web.Webview.Core 2101 * @since 10 2102 */ 2103 /** 2104 * The number data type. 2105 * 2106 * @syscap SystemCapability.Web.Webview.Core 2107 * @atomicservice 2108 * @since 11 2109 */ 2110 /** 2111 * The number data type. 2112 * 2113 * @syscap SystemCapability.Web.Webview.Core 2114 * @crossplatform 2115 * @atomicservice 2116 * @since 18 2117 */ 2118 NUMBER, 2119 2120 /** 2121 * The boolean data type. 2122 * 2123 * @syscap SystemCapability.Web.Webview.Core 2124 * @since 10 2125 */ 2126 /** 2127 * The boolean data type. 2128 * 2129 * @syscap SystemCapability.Web.Webview.Core 2130 * @atomicservice 2131 * @since 11 2132 */ 2133 /** 2134 * The boolean data type. 2135 * 2136 * @syscap SystemCapability.Web.Webview.Core 2137 * @crossplatform 2138 * @atomicservice 2139 * @since 18 2140 */ 2141 BOOLEAN, 2142 2143 /** 2144 * The arraybuffer data type. 2145 * 2146 * @syscap SystemCapability.Web.Webview.Core 2147 * @since 10 2148 */ 2149 /** 2150 * The arraybuffer data type. 2151 * 2152 * @syscap SystemCapability.Web.Webview.Core 2153 * @atomicservice 2154 * @since 11 2155 */ 2156 ARRAY_BUFFER, 2157 2158 /** 2159 * The array data type. 2160 * 2161 * @syscap SystemCapability.Web.Webview.Core 2162 * @since 10 2163 */ 2164 /** 2165 * The array data type. 2166 * 2167 * @syscap SystemCapability.Web.Webview.Core 2168 * @atomicservice 2169 * @since 11 2170 */ 2171 /** 2172 * The array data type. 2173 * 2174 * @syscap SystemCapability.Web.Webview.Core 2175 * @crossplatform 2176 * @atomicservice 2177 * @since 18 2178 */ 2179 ARRAY, 2180 2181 /** 2182 * The error data type. 2183 * 2184 * @syscap SystemCapability.Web.Webview.Core 2185 * @since 10 2186 */ 2187 /** 2188 * The error data type. 2189 * 2190 * @syscap SystemCapability.Web.Webview.Core 2191 * @atomicservice 2192 * @since 11 2193 */ 2194 /** 2195 * The error data type. 2196 * 2197 * @syscap SystemCapability.Web.Webview.Core 2198 * @crossplatform 2199 * @atomicservice 2200 * @since 18 2201 */ 2202 ERROR 2203 } 2204 2205 /** 2206 * The message received or sent from web message port. 2207 * 2208 * @syscap SystemCapability.Web.Webview.Core 2209 * @since 10 2210 */ 2211 /** 2212 * The message received or sent from web message port. 2213 * 2214 * @syscap SystemCapability.Web.Webview.Core 2215 * @atomicservice 2216 * @since 11 2217 */ 2218 /** 2219 * The message received or sent from web message port. 2220 * 2221 * @syscap SystemCapability.Web.Webview.Core 2222 * @crossplatform 2223 * @atomicservice 2224 * @since 18 2225 */ 2226 class WebMessageExt { 2227 /** 2228 * Get the type of the web message. 2229 * @returns { WebMessageType } - Returns data of WebMessageType type 2230 * @syscap SystemCapability.Web.Webview.Core 2231 * @since 10 2232 */ 2233 /** 2234 * Get the type of the web message. 2235 * @returns { WebMessageType } - Returns data of WebMessageType type 2236 * @syscap SystemCapability.Web.Webview.Core 2237 * @atomicservice 2238 * @since 11 2239 */ 2240 /** 2241 * Get the type of the web message. 2242 * @returns { WebMessageType } - Returns data of WebMessageType type 2243 * @syscap SystemCapability.Web.Webview.Core 2244 * @crossplatform 2245 * @atomicservice 2246 * @since 18 2247 */ 2248 getType(): WebMessageType; 2249 2250 /** 2251 * Get the string value of the web message. 2252 * @returns { string } - Returns data of string type 2253 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 2254 * 2255 * @syscap SystemCapability.Web.Webview.Core 2256 * @since 10 2257 */ 2258 /** 2259 * Get the string value of the web message. 2260 * @returns { string } - Returns data of string type 2261 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 2262 * 2263 * @syscap SystemCapability.Web.Webview.Core 2264 * @atomicservice 2265 * @since 11 2266 */ 2267 /** 2268 * Get the string value of the web message. 2269 * @returns { string } - Returns data of string type 2270 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 2271 * 2272 * @syscap SystemCapability.Web.Webview.Core 2273 * @crossplatform 2274 * @atomicservice 2275 * @since 18 2276 */ 2277 getString(): string; 2278 2279 /** 2280 * Get the number value of the web message. 2281 * @returns { number } - Returns data of number type 2282 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 2283 * 2284 * @syscap SystemCapability.Web.Webview.Core 2285 * @since 10 2286 */ 2287 /** 2288 * Get the number value of the web message. 2289 * @returns { number } - Returns data of number type 2290 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 2291 * 2292 * @syscap SystemCapability.Web.Webview.Core 2293 * @atomicservice 2294 * @since 11 2295 */ 2296 /** 2297 * Get the number value of the web message. 2298 * @returns { number } - Returns data of number type 2299 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 2300 * 2301 * @syscap SystemCapability.Web.Webview.Core 2302 * @crossplatform 2303 * @atomicservice 2304 * @since 18 2305 */ 2306 getNumber(): number; 2307 2308 /** 2309 * Get the boolean value of the web message. 2310 * @returns { boolean } - Returns data of Boolean type 2311 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 2312 * 2313 * @syscap SystemCapability.Web.Webview.Core 2314 * @since 10 2315 */ 2316 /** 2317 * Get the boolean value of the web message. 2318 * @returns { boolean } - Returns data of Boolean type 2319 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 2320 * 2321 * @syscap SystemCapability.Web.Webview.Core 2322 * @atomicservice 2323 * @since 11 2324 */ 2325 /** 2326 * Get the boolean value of the web message. 2327 * @returns { boolean } - Returns data of Boolean type 2328 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 2329 * 2330 * @syscap SystemCapability.Web.Webview.Core 2331 * @crossplatform 2332 * @atomicservice 2333 * @since 18 2334 */ 2335 getBoolean(): boolean; 2336 2337 /** 2338 * Get the array buffer value of the web message. 2339 * @returns { ArrayBuffer } - Returns data of ArrayBuffer type 2340 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 2341 * 2342 * @syscap SystemCapability.Web.Webview.Core 2343 * @since 10 2344 */ 2345 /** 2346 * Get the array buffer value of the web message. 2347 * @returns { ArrayBuffer } - Returns data of ArrayBuffer type 2348 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 2349 * 2350 * @syscap SystemCapability.Web.Webview.Core 2351 * @atomicservice 2352 * @since 11 2353 */ 2354 getArrayBuffer(): ArrayBuffer; 2355 2356 /** 2357 * Get the array value of the web message. 2358 * @returns { Array<string | number | boolean> } - Returns data of Array type 2359 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 2360 * 2361 * @syscap SystemCapability.Web.Webview.Core 2362 * @since 10 2363 */ 2364 /** 2365 * Get the array value of the web message. 2366 * @returns { Array<string | number | boolean> } - Returns data of Array type 2367 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 2368 * 2369 * @syscap SystemCapability.Web.Webview.Core 2370 * @atomicservice 2371 * @since 11 2372 */ 2373 /** 2374 * Get the array value of the web message. 2375 * @returns { Array<string | number | boolean> } - Returns data of Array type 2376 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 2377 * 2378 * @syscap SystemCapability.Web.Webview.Core 2379 * @crossplatform 2380 * @atomicservice 2381 * @since 18 2382 */ 2383 getArray(): Array<string | number | boolean>; 2384 2385 /** 2386 * Get the error value of the web message. 2387 * @returns { Error } - Returns data of Error type 2388 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 2389 * 2390 * @syscap SystemCapability.Web.Webview.Core 2391 * @since 10 2392 */ 2393 /** 2394 * Get the error value of the web message. 2395 * @returns { Error } - Returns data of Error type 2396 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 2397 * 2398 * @syscap SystemCapability.Web.Webview.Core 2399 * @atomicservice 2400 * @since 11 2401 */ 2402 /** 2403 * Get the error value of the web message. 2404 * @returns { Error } - Returns data of Error type 2405 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 2406 * 2407 * @syscap SystemCapability.Web.Webview.Core 2408 * @crossplatform 2409 * @atomicservice 2410 * @since 18 2411 */ 2412 getError(): Error; 2413 2414 /** 2415 * Set the type of the web message. 2416 * @param { WebMessageType } type - set WebMessageType type data 2417 * @throws { BusinessError } 401 - Invalid input parameter. 2418 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 2419 * 2420 * @syscap SystemCapability.Web.Webview.Core 2421 * @since 10 2422 */ 2423 /** 2424 * Set the type of the web message. 2425 * @param { WebMessageType } type - set WebMessageType type data 2426 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2427 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 2428 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 2429 * 2430 * @syscap SystemCapability.Web.Webview.Core 2431 * @atomicservice 2432 * @since 11 2433 */ 2434 /** 2435 * Set the type of the web message. 2436 * @param { WebMessageType } type - set WebMessageType type data 2437 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2438 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 2439 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 2440 * 2441 * @syscap SystemCapability.Web.Webview.Core 2442 * @crossplatform 2443 * @atomicservice 2444 * @since 18 2445 */ 2446 setType(type: WebMessageType): void; 2447 2448 /** 2449 * Set the string value of the web message. 2450 * @param { string } message - set string type data 2451 * @throws { BusinessError } 401 - Invalid input parameter. 2452 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 2453 * 2454 * @syscap SystemCapability.Web.Webview.Core 2455 * @since 10 2456 */ 2457 /** 2458 * Set the string value of the web message. 2459 * @param { string } message - set string type data 2460 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2461 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 2462 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 2463 * 2464 * @syscap SystemCapability.Web.Webview.Core 2465 * @atomicservice 2466 * @since 11 2467 */ 2468 /** 2469 * Set the string value of the web message. 2470 * @param { string } message - set string type data 2471 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2472 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 2473 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 2474 * 2475 * @syscap SystemCapability.Web.Webview.Core 2476 * @crossplatform 2477 * @atomicservice 2478 * @since 18 2479 */ 2480 setString(message: string): void; 2481 2482 /** 2483 * Set the number value of the web message. 2484 * @param { number } message - set number type data 2485 * @throws { BusinessError } 401 - Invalid input parameter. 2486 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 2487 * 2488 * @syscap SystemCapability.Web.Webview.Core 2489 * @since 10 2490 */ 2491 /** 2492 * Set the number value of the web message. 2493 * @param { number } message - set number type data 2494 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2495 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 2496 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 2497 * 2498 * @syscap SystemCapability.Web.Webview.Core 2499 * @atomicservice 2500 * @since 11 2501 */ 2502 /** 2503 * Set the number value of the web message. 2504 * @param { number } message - set number type data 2505 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2506 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 2507 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 2508 * 2509 * @syscap SystemCapability.Web.Webview.Core 2510 * @crossplatform 2511 * @atomicservice 2512 * @since 18 2513 */ 2514 setNumber(message: number): void; 2515 2516 /** 2517 * Set the boolean value of the web message. 2518 * @param { boolean } message - set boolean type data 2519 * @throws { BusinessError } 401 - Invalid input parameter. 2520 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 2521 * 2522 * @syscap SystemCapability.Web.Webview.Core 2523 * @since 10 2524 */ 2525 /** 2526 * Set the boolean value of the web message. 2527 * @param { boolean } message - set boolean type data 2528 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2529 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 2530 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 2531 * 2532 * @syscap SystemCapability.Web.Webview.Core 2533 * @atomicservice 2534 * @since 11 2535 */ 2536 /** 2537 * Set the boolean value of the web message. 2538 * @param { boolean } message - set boolean type data 2539 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2540 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 2541 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 2542 * 2543 * @syscap SystemCapability.Web.Webview.Core 2544 * @crossplatform 2545 * @atomicservice 2546 * @since 18 2547 */ 2548 setBoolean(message: boolean): void; 2549 2550 /** 2551 * Set the array buffer value of the web message. 2552 * @param { ArrayBuffer } message - set ArrayBuffer type data 2553 * @throws { BusinessError } 401 - Invalid input parameter. 2554 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 2555 * 2556 * @syscap SystemCapability.Web.Webview.Core 2557 * @since 10 2558 */ 2559 /** 2560 * Set the array buffer value of the web message. 2561 * @param { ArrayBuffer } message - set ArrayBuffer type data 2562 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2563 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 2564 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 2565 * 2566 * @syscap SystemCapability.Web.Webview.Core 2567 * @atomicservice 2568 * @since 11 2569 */ 2570 setArrayBuffer(message: ArrayBuffer): void; 2571 2572 /** 2573 * Set the array value of the web message. 2574 * @param { Array<string | number | boolean> } message - set Array type data 2575 * @throws { BusinessError } 401 - Invalid input parameter. 2576 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 2577 * @syscap SystemCapability.Web.Webview.Core 2578 * @since 10 2579 */ 2580 /** 2581 * Set the array value of the web message. 2582 * @param { Array<string | number | boolean> } message - set Array type data 2583 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2584 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 2585 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 2586 * @syscap SystemCapability.Web.Webview.Core 2587 * @atomicservice 2588 * @since 11 2589 */ 2590 /** 2591 * Set the array value of the web message. 2592 * @param { Array<string | number | boolean> } message - set Array type data 2593 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2594 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 2595 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 2596 * @syscap SystemCapability.Web.Webview.Core 2597 * @crossplatform 2598 * @atomicservice 2599 * @since 18 2600 */ 2601 setArray(message: Array<string | number | boolean>): void; 2602 2603 /** 2604 * Set the error value of the web message. 2605 * @param { Error } message - set Error type data 2606 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2607 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 2608 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 2609 * 2610 * @syscap SystemCapability.Web.Webview.Core 2611 * @since 10 2612 */ 2613 /** 2614 * Set the error value of the web message. 2615 * @param { Error } message - set Error type data 2616 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2617 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 2618 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 2619 * 2620 * @syscap SystemCapability.Web.Webview.Core 2621 * @atomicservice 2622 * @since 11 2623 */ 2624 /** 2625 * Set the error value of the web message. 2626 * @param { Error } message - set Error type data 2627 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2628 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 2629 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 2630 * 2631 * @syscap SystemCapability.Web.Webview.Core 2632 * @crossplatform 2633 * @atomicservice 2634 * @since 18 2635 */ 2636 setError(message: Error): void; 2637 } 2638 2639 /** 2640 * WebMessage type supplied to {@link onMessageEventExt} for indicating the type of web message. 2641 * 2642 * @syscap SystemCapability.Web.Webview.Core 2643 * @since 9 2644 */ 2645 /** 2646 * WebMessage type supplied to {@link onMessageEventExt} for indicating the type of web message. 2647 * 2648 * @typedef { ArrayBuffer | string } 2649 * @syscap SystemCapability.Web.Webview.Core 2650 * @atomicservice 2651 * @since 11 2652 */ 2653 type WebMessage = ArrayBuffer | string; 2654 /** 2655 * Define html web message port. 2656 * @interface WebMessagePort 2657 * @syscap SystemCapability.Web.Webview.Core 2658 * @since 9 2659 */ 2660 /** 2661 * Define html web message port. 2662 * @interface WebMessagePort 2663 * @syscap SystemCapability.Web.Webview.Core 2664 * @crossplatform 2665 * @atomicservice 2666 * @since 11 2667 */ 2668 /** 2669 * Define html web message port. 2670 * @typedef WebMessagePort 2671 * @syscap SystemCapability.Web.Webview.Core 2672 * @crossplatform 2673 * @atomicservice 2674 * @since 12 2675 */ 2676 interface WebMessagePort { 2677 /** 2678 * The flag indicates whether more formats are supported than string and array buffers. 2679 * 2680 * @syscap SystemCapability.Web.Webview.Core 2681 * @since 10 2682 */ 2683 /** 2684 * The flag indicates whether more formats are supported than string and array buffers. 2685 * 2686 * @type { ?boolean } 2687 * @syscap SystemCapability.Web.Webview.Core 2688 * @atomicservice 2689 * @since 11 2690 */ 2691 isExtentionType?: boolean; 2692 2693 /** 2694 * Close port. 2695 * @syscap SystemCapability.Web.Webview.Core 2696 * @since 9 2697 */ 2698 /** 2699 * Close port. 2700 * @syscap SystemCapability.Web.Webview.Core 2701 * @crossplatform 2702 * @atomicservice 2703 * @since 11 2704 */ 2705 close(): void; 2706 2707 /** 2708 * Post a message to other port. 2709 * @param { WebMessage } message - Message to send. 2710 * @throws { BusinessError } 401 - Invalid input parameter. 2711 * @throws { BusinessError } 17100010 - Failed to post messages through the port. 2712 * @syscap SystemCapability.Web.Webview.Core 2713 * @since 9 2714 */ 2715 /** 2716 * Post a message to other port. 2717 * @param { WebMessage } message - Message to send. 2718 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2719 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 2720 * @throws { BusinessError } 17100010 - Failed to post messages through the port. 2721 * @syscap SystemCapability.Web.Webview.Core 2722 * @crossplatform 2723 * @atomicservice 2724 * @since 11 2725 */ 2726 postMessageEvent(message: WebMessage): void; 2727 2728 /** 2729 * Receive message from other port. 2730 * @param { function } callback - Callback function for receiving messages. 2731 * @throws { BusinessError } 401 - Invalid input parameter. 2732 * @throws { BusinessError } 17100006 - Failed to register a message event for the port. 2733 * @syscap SystemCapability.Web.Webview.Core 2734 * @since 9 2735 */ 2736 /** 2737 * Receive message from other port. 2738 * @param { function } callback - Callback function for receiving messages. 2739 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2740 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 2741 * @throws { BusinessError } 17100006 - Failed to register a message event for the port. 2742 * @syscap SystemCapability.Web.Webview.Core 2743 * @crossplatform 2744 * @atomicservice 2745 * @since 11 2746 */ 2747 onMessageEvent(callback: (result: WebMessage) => void): void; 2748 2749 /** 2750 * Post a message to other port. 2751 * @param { WebMessageExt } message - Message to send. 2752 * @throws { BusinessError } 401 - Invalid input parameter. 2753 * @throws { BusinessError } 17100010 - Failed to post messages through the port. 2754 * @syscap SystemCapability.Web.Webview.Core 2755 * @since 10 2756 */ 2757 /** 2758 * Post a message to other port. 2759 * @param { WebMessageExt } message - Message to send. 2760 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2761 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 2762 * @throws { BusinessError } 17100010 - Failed to post messages through the port. 2763 * @syscap SystemCapability.Web.Webview.Core 2764 * @atomicservice 2765 * @since 11 2766 */ 2767 /** 2768 * Post a message to other port. 2769 * @param { WebMessageExt } message - Message to send. 2770 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2771 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 2772 * @throws { BusinessError } 17100010 - Failed to post messages through the port. 2773 * @syscap SystemCapability.Web.Webview.Core 2774 * @crossplatform 2775 * @atomicservice 2776 * @since 18 2777 */ 2778 postMessageEventExt(message: WebMessageExt): void; 2779 2780 /** 2781 * Receive message from other port. 2782 * @param { function } callback - Callback function for receiving messages. 2783 * @throws { BusinessError } 401 - Invalid input parameter. 2784 * @throws { BusinessError } 17100006 - Failed to register a message event for the port. 2785 * @syscap SystemCapability.Web.Webview.Core 2786 * @since 10 2787 */ 2788 /** 2789 * Receive message from other port. 2790 * @param { function } callback - Callback function for receiving messages. 2791 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2792 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 2793 * @throws { BusinessError } 17100006 - Failed to register a message event for the port. 2794 * @syscap SystemCapability.Web.Webview.Core 2795 * @atomicservice 2796 * @since 11 2797 */ 2798 /** 2799 * Receive message from other port. 2800 * @param { function } callback - Callback function for receiving messages. 2801 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2802 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 2803 * @throws { BusinessError } 17100006 - Failed to register a message event for the port. 2804 * @syscap SystemCapability.Web.Webview.Core 2805 * @crossplatform 2806 * @atomicservice 2807 * @since 18 2808 */ 2809 onMessageEventExt(callback: (result: WebMessageExt) => void): void; 2810 } 2811 2812 /** 2813 * Provides information for history item in BackForwardList. 2814 * @interface HistoryItem 2815 * @syscap SystemCapability.Web.Webview.Core 2816 * @since 9 2817 */ 2818 /** 2819 * Provides information for history item in BackForwardList. 2820 * @interface HistoryItem 2821 * @syscap SystemCapability.Web.Webview.Core 2822 * @crossplatform 2823 * @atomicservice 2824 * @since 11 2825 */ 2826 /** 2827 * Provides information for history item in BackForwardList. 2828 * @typedef HistoryItem 2829 * @syscap SystemCapability.Web.Webview.Core 2830 * @crossplatform 2831 * @atomicservice 2832 * @since 12 2833 */ 2834 interface HistoryItem { 2835 /** 2836 * Pixelmap of icon. 2837 * @syscap SystemCapability.Web.Webview.Core 2838 * @since 9 2839 */ 2840 /** 2841 * Pixelmap of icon. 2842 * @type { image.PixelMap } 2843 * @syscap SystemCapability.Web.Webview.Core 2844 * @atomicservice 2845 * @since 11 2846 */ 2847 icon: image.PixelMap; 2848 2849 /** 2850 * Url of this history item. 2851 * @syscap SystemCapability.Web.Webview.Core 2852 * @since 9 2853 */ 2854 /** 2855 * Url of this history item. 2856 * @type { string } 2857 * @syscap SystemCapability.Web.Webview.Core 2858 * @crossplatform 2859 * @atomicservice 2860 * @since 11 2861 */ 2862 historyUrl: string; 2863 2864 /** 2865 * Original request url of this history item. 2866 * @syscap SystemCapability.Web.Webview.Core 2867 * @since 9 2868 */ 2869 /** 2870 * Original request url of this history item. 2871 * @type { string } 2872 * @syscap SystemCapability.Web.Webview.Core 2873 * @crossplatform 2874 * @atomicservice 2875 * @since 11 2876 */ 2877 historyRawUrl: string; 2878 2879 /** 2880 * Title of this history item. 2881 * @syscap SystemCapability.Web.Webview.Core 2882 * @since 9 2883 */ 2884 /** 2885 * Title of this history item. 2886 * @type { string } 2887 * @syscap SystemCapability.Web.Webview.Core 2888 * @crossplatform 2889 * @atomicservice 2890 * @since 11 2891 */ 2892 title: string; 2893 } 2894 2895 /** 2896 * Provides back and forward history list information method. related to {@link HistoryItem}. 2897 * @interface BackForwardList 2898 * @syscap SystemCapability.Web.Webview.Core 2899 * @since 9 2900 */ 2901 /** 2902 * Provides back and forward history list information method. related to {@link HistoryItem}. 2903 * @interface BackForwardList 2904 * @syscap SystemCapability.Web.Webview.Core 2905 * @crossplatform 2906 * @atomicservice 2907 * @since 11 2908 */ 2909 /** 2910 * Provides back and forward history list information method. related to {@link HistoryItem}. 2911 * @typedef BackForwardList 2912 * @syscap SystemCapability.Web.Webview.Core 2913 * @crossplatform 2914 * @atomicservice 2915 * @since 12 2916 */ 2917 interface BackForwardList { 2918 /** 2919 * Current index in BackForwardList. 2920 * @syscap SystemCapability.Web.Webview.Core 2921 * @since 9 2922 */ 2923 /** 2924 * Current index in BackForwardList. 2925 * @type { number } 2926 * @syscap SystemCapability.Web.Webview.Core 2927 * @crossplatform 2928 * @atomicservice 2929 * @since 11 2930 */ 2931 currentIndex: number; 2932 2933 /** 2934 * Size of in BackForwardList. 2935 * @syscap SystemCapability.Web.Webview.Core 2936 * @since 9 2937 */ 2938 /** 2939 * Size of in BackForwardList. 2940 * @type { number } 2941 * @syscap SystemCapability.Web.Webview.Core 2942 * @crossplatform 2943 * @atomicservice 2944 * @since 11 2945 */ 2946 size: number; 2947 2948 /** 2949 * Get history entry at given index. 2950 * 2951 * @param { number } index Index of back forward list entry. 2952 * @returns { HistoryItem } HistoryItem at given index in back forward list. 2953 * @throws { BusinessError } 401 - Invalid input parameter. 2954 * @syscap SystemCapability.Web.Webview.Core 2955 * @since 9 2956 */ 2957 /** 2958 * Get history entry at given index. 2959 * 2960 * @param { number } index Index of back forward list entry. 2961 * @returns { HistoryItem } HistoryItem at given index in back forward list. 2962 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2963 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 2964 * @syscap SystemCapability.Web.Webview.Core 2965 * @crossplatform 2966 * @atomicservice 2967 * @since 11 2968 */ 2969 getItemAtIndex(index: number): HistoryItem; 2970 } 2971 2972 /** 2973 * Defines the snapshot info. 2974 * 2975 * @typedef SnapshotInfo 2976 * @syscap SystemCapability.Web.Webview.Core 2977 * @atomicservice 2978 * @since 12 2979 */ 2980 interface SnapshotInfo { 2981 /** 2982 * Id of the snapshot. 2983 * 2984 * @type { ?string } 2985 * @syscap SystemCapability.Web.Webview.Core 2986 * @atomicservice 2987 * @since 12 2988 */ 2989 id?: string; 2990 2991 /** 2992 * Size of the web. 2993 * 2994 * @type { ?SizeOptions } 2995 * @syscap SystemCapability.Web.Webview.Core 2996 * @atomicservice 2997 * @since 12 2998 */ 2999 size?: SizeOptions; 3000 } 3001 3002 /** 3003 * Defines the snapshot result. 3004 * 3005 * @typedef SnapshotResult 3006 * @syscap SystemCapability.Web.Webview.Core 3007 * @atomicservice 3008 * @since 12 3009 */ 3010 interface SnapshotResult { 3011 /** 3012 * Id of the snapshot. 3013 * 3014 * @type { ?string } 3015 * @syscap SystemCapability.Web.Webview.Core 3016 * @atomicservice 3017 * @since 12 3018 */ 3019 id?: string; 3020 3021 /** 3022 * The status of the snapshot. 3023 * 3024 * @type { ?boolean } 3025 * @syscap SystemCapability.Web.Webview.Core 3026 * @atomicservice 3027 * @since 12 3028 */ 3029 status?: boolean; 3030 3031 /** 3032 * Size of the web. 3033 * 3034 * @type { ?SizeOptions } 3035 * @syscap SystemCapability.Web.Webview.Core 3036 * @atomicservice 3037 * @since 12 3038 */ 3039 size?: SizeOptions; 3040 3041 /** 3042 * The image in PixelMap format. 3043 * 3044 * @type { ?image.PixelMap } 3045 * @syscap SystemCapability.Web.Webview.Core 3046 * @atomicservice 3047 * @since 12 3048 */ 3049 imagePixelMap?: image.PixelMap; 3050 } 3051 /** 3052 * Enum type supplied to {@link runJavaScriptExt} for indicating the result of JavaScript code execution. 3053 * @enum {number} 3054 * @syscap SystemCapability.Web.Webview.Core 3055 * @since 10 3056 */ 3057 /** 3058 * Enum type supplied to {@link runJavaScriptExt} for indicating the result of JavaScript code execution. 3059 * @enum {number} 3060 * @syscap SystemCapability.Web.Webview.Core 3061 * @atomicservice 3062 * @since 11 3063 */ 3064 /** 3065 * Enum type supplied to {@link runJavaScriptExt} for indicating the result of JavaScript code execution. 3066 * @enum {number} 3067 * @syscap SystemCapability.Web.Webview.Core 3068 * @crossplatform 3069 * @atomicservice 3070 * @since 18 3071 */ 3072 enum JsMessageType { 3073 /** 3074 * Unsupported data type. 3075 * @syscap SystemCapability.Web.Webview.Core 3076 * @since 10 3077 */ 3078 /** 3079 * Unsupported data type. 3080 * @syscap SystemCapability.Web.Webview.Core 3081 * @atomicservice 3082 * @since 11 3083 */ 3084 NOT_SUPPORT, 3085 3086 /** 3087 * The string data type. 3088 * @syscap SystemCapability.Web.Webview.Core 3089 * @since 10 3090 */ 3091 /** 3092 * The string data type. 3093 * @syscap SystemCapability.Web.Webview.Core 3094 * @atomicservice 3095 * @since 11 3096 */ 3097 /** 3098 * The string data type. 3099 * @syscap SystemCapability.Web.Webview.Core 3100 * @crossplatform 3101 * @atomicservice 3102 * @since 18 3103 */ 3104 STRING, 3105 3106 /** 3107 * The number data type. 3108 * @syscap SystemCapability.Web.Webview.Core 3109 * @since 10 3110 */ 3111 /** 3112 * The number data type. 3113 * @syscap SystemCapability.Web.Webview.Core 3114 * @atomicservice 3115 * @since 11 3116 */ 3117 /** 3118 * The number data type. 3119 * @syscap SystemCapability.Web.Webview.Core 3120 * @crossplatform 3121 * @atomicservice 3122 * @since 18 3123 */ 3124 NUMBER, 3125 3126 /** 3127 * The boolean data type. 3128 * @syscap SystemCapability.Web.Webview.Core 3129 * @since 10 3130 */ 3131 /** 3132 * The boolean data type. 3133 * @syscap SystemCapability.Web.Webview.Core 3134 * @atomicservice 3135 * @since 11 3136 */ 3137 /** 3138 * The boolean data type. 3139 * @syscap SystemCapability.Web.Webview.Core 3140 * @crossplatform 3141 * @atomicservice 3142 * @since 18 3143 */ 3144 BOOLEAN, 3145 3146 /** 3147 * The arraybuffer data type. 3148 * @syscap SystemCapability.Web.Webview.Core 3149 * @since 10 3150 */ 3151 /** 3152 * The arraybuffer data type. 3153 * @syscap SystemCapability.Web.Webview.Core 3154 * @atomicservice 3155 * @since 11 3156 */ 3157 ARRAY_BUFFER, 3158 3159 /** 3160 * The array data type. 3161 * @syscap SystemCapability.Web.Webview.Core 3162 * @since 10 3163 */ 3164 /** 3165 * The array data type. 3166 * @syscap SystemCapability.Web.Webview.Core 3167 * @atomicservice 3168 * @since 11 3169 */ 3170 /** 3171 * The array data type. 3172 * @syscap SystemCapability.Web.Webview.Core 3173 * @crossplatform 3174 * @atomicservice 3175 * @since 18 3176 */ 3177 ARRAY 3178 } 3179 3180 /** 3181 * The message for indicating the of result of JavaScript code execution. 3182 * @syscap SystemCapability.Web.Webview.Core 3183 * @since 10 3184 */ 3185 /** 3186 * The message for indicating the of result of JavaScript code execution. 3187 * @syscap SystemCapability.Web.Webview.Core 3188 * @atomicservice 3189 * @since 11 3190 */ 3191 /** 3192 * The message for indicating the of result of JavaScript code execution. 3193 * @syscap SystemCapability.Web.Webview.Core 3194 * @crossplatform 3195 * @atomicservice 3196 * @since 18 3197 */ 3198 class JsMessageExt { 3199 /** 3200 * Get the type of the JavaScript code execution result. 3201 * @returns { JsMessageType } - Returns data of JsMessageType type 3202 * @syscap SystemCapability.Web.Webview.Core 3203 * @since 10 3204 */ 3205 /** 3206 * Get the type of the JavaScript code execution result. 3207 * @returns { JsMessageType } - Returns data of JsMessageType type 3208 * @syscap SystemCapability.Web.Webview.Core 3209 * @atomicservice 3210 * @since 11 3211 */ 3212 /** 3213 * Get the type of the JavaScript code execution result. 3214 * @returns { JsMessageType } - Returns data of JsMessageType type 3215 * @syscap SystemCapability.Web.Webview.Core 3216 * @crossplatform 3217 * @atomicservice 3218 * @since 18 3219 */ 3220 getType(): JsMessageType; 3221 3222 /** 3223 * Get the string value of the JavaScript code execution result. 3224 * @returns { string } - Returns data of string type 3225 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 3226 * @syscap SystemCapability.Web.Webview.Core 3227 * @since 10 3228 */ 3229 /** 3230 * Get the string value of the JavaScript code execution result. 3231 * @returns { string } - Returns data of string type 3232 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 3233 * @syscap SystemCapability.Web.Webview.Core 3234 * @atomicservice 3235 * @since 11 3236 */ 3237 /** 3238 * Get the string value of the JavaScript code execution result. 3239 * @returns { string } - Returns data of string type 3240 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 3241 * @syscap SystemCapability.Web.Webview.Core 3242 * @crossplatform 3243 * @atomicservice 3244 * @since 18 3245 */ 3246 getString(): string; 3247 3248 /** 3249 * Get the number value of the JavaScript code execution result. 3250 * @returns { number } - Returns data of number type 3251 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 3252 * @syscap SystemCapability.Web.Webview.Core 3253 * @since 10 3254 */ 3255 /** 3256 * Get the number value of the JavaScript code execution result. 3257 * @returns { number } - Returns data of number type 3258 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 3259 * @syscap SystemCapability.Web.Webview.Core 3260 * @atomicservice 3261 * @since 11 3262 */ 3263 /** 3264 * Get the number value of the JavaScript code execution result. 3265 * @returns { number } - Returns data of number type 3266 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 3267 * @syscap SystemCapability.Web.Webview.Core 3268 * @crossplatform 3269 * @atomicservice 3270 * @since 18 3271 */ 3272 getNumber(): number; 3273 3274 /** 3275 * Get the boolean value of the JavaScript code execution result. 3276 * @returns { boolean } - Returns data of Boolean type 3277 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 3278 * @syscap SystemCapability.Web.Webview.Core 3279 * @since 10 3280 */ 3281 /** 3282 * Get the boolean value of the JavaScript code execution result. 3283 * @returns { boolean } - Returns data of Boolean type 3284 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 3285 * @syscap SystemCapability.Web.Webview.Core 3286 * @atomicservice 3287 * @since 11 3288 */ 3289 /** 3290 * Get the boolean value of the JavaScript code execution result. 3291 * @returns { boolean } - Returns data of Boolean type 3292 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 3293 * @syscap SystemCapability.Web.Webview.Core 3294 * @crossplatform 3295 * @atomicservice 3296 * @since 18 3297 */ 3298 getBoolean(): boolean; 3299 3300 /** 3301 * Get the array buffer value of the JavaScript code execution result. 3302 * @returns { ArrayBuffer } - Returns data of ArrayBuffer 3303 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 3304 * @syscap SystemCapability.Web.Webview.Core 3305 * @since 10 3306 */ 3307 /** 3308 * Get the array buffer value of the JavaScript code execution result. 3309 * @returns { ArrayBuffer } - Returns data of ArrayBuffer 3310 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 3311 * @syscap SystemCapability.Web.Webview.Core 3312 * @atomicservice 3313 * @since 11 3314 */ 3315 getArrayBuffer(): ArrayBuffer; 3316 3317 /** 3318 * Get the array value of the the JavaScript code execution result. 3319 * @returns { Array<string | number | boolean> } - Returns data of Array type 3320 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 3321 * @syscap SystemCapability.Web.Webview.Core 3322 * @since 10 3323 */ 3324 /** 3325 * Get the array value of the the JavaScript code execution result. 3326 * @returns { Array<string | number | boolean> } - Returns data of Array type 3327 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 3328 * @syscap SystemCapability.Web.Webview.Core 3329 * @atomicservice 3330 * @since 11 3331 */ 3332 /** 3333 * Get the array value of the the JavaScript code execution result. 3334 * @returns { Array<string | number | boolean> } - Returns data of Array type 3335 * @throws { BusinessError } 17100014 - The type and value of the message do not match. 3336 * @syscap SystemCapability.Web.Webview.Core 3337 * @crossplatform 3338 * @atomicservice 3339 * @since 18 3340 */ 3341 getArray(): Array<string | number | boolean>; 3342 } 3343 3344 /** 3345 * Defines the render process mode. 3346 * 3347 * @enum {number} 3348 * @syscap SystemCapability.Web.Webview.Core 3349 * @atomicservice 3350 * @since 12 3351 */ 3352 enum RenderProcessMode { 3353 /** 3354 * Indicates the ArkWeb operates in single render process mode, which is the default value for 3355 * mobile devices. 3356 * 3357 * @syscap SystemCapability.Web.Webview.Core 3358 * @atomicservice 3359 * @since 12 3360 */ 3361 SINGLE = 0, 3362 3363 /** 3364 * Indicates the ArkWeb operates in multiple render process mode. 3365 * 3366 * @syscap SystemCapability.Web.Webview.Core 3367 * @atomicservice 3368 * @since 12 3369 */ 3370 MULTIPLE, 3371 } 3372 3373 /** 3374 * Options of generating code cache 3375 * @typedef CacheOptions 3376 * @syscap SystemCapability.Web.Webview.Core 3377 * @since 12 3378 */ 3379 interface CacheOptions { 3380 /** 3381 * Response headers used to configure the validation key of code cache. 3382 * Currently only support E-Tag and Last-Modified. 3383 * 3384 * @type { Array<WebHeader> } 3385 * @syscap SystemCapability.Web.Webview.Core 3386 * @since 12 3387 */ 3388 responseHeaders: Array<WebHeader>; 3389 } 3390 3391 /** 3392 * Enum type supplied to {@link OfflineResourceMap} for indicating the type of resource. 3393 * @enum {number} 3394 * @syscap SystemCapability.Web.Webview.Core 3395 * @since 12 3396 */ 3397 enum OfflineResourceType { 3398 /** 3399 * Image resource 3400 * 3401 * @syscap SystemCapability.Web.Webview.Core 3402 * @since 12 3403 */ 3404 IMAGE, 3405 3406 /** 3407 * CSS resource 3408 * 3409 * @syscap SystemCapability.Web.Webview.Core 3410 * @since 12 3411 */ 3412 CSS, 3413 3414 /** 3415 * Classic javascript resource 3416 * 3417 * @syscap SystemCapability.Web.Webview.Core 3418 * @since 12 3419 */ 3420 CLASSIC_JS, 3421 3422 /** 3423 * Module javascript resource 3424 * 3425 * @syscap SystemCapability.Web.Webview.Core 3426 * @since 12 3427 */ 3428 MODULE_JS 3429 } 3430 3431 /** 3432 * Define offline resource's content and info. 3433 * @typedef OfflineResourceMap 3434 * @syscap SystemCapability.Web.Webview.Core 3435 * @since 12 3436 */ 3437 interface OfflineResourceMap { 3438 /** 3439 * Url list of resource. Url of urlList must be HTTP/HTTPS protocol and no longer than 2048. 3440 * 3441 * @type { Array<string> } 3442 * @syscap SystemCapability.Web.Webview.Core 3443 * @since 12 3444 */ 3445 urlList: Array<string>, 3446 3447 /** 3448 * Arraybuffer of resource. Size must less than 10Mb and cannot be empty. 3449 * 3450 * @type { Uint8Array } 3451 * @syscap SystemCapability.Web.Webview.Core 3452 * @since 12 3453 */ 3454 resource: Uint8Array, 3455 3456 /** 3457 * Response headers of resource. 3458 * 3459 * @type { Array<WebHeader> } 3460 * @syscap SystemCapability.Web.Webview.Core 3461 * @since 12 3462 */ 3463 responseHeaders: Array<WebHeader>, 3464 3465 /** 3466 * Resource type 3467 * 3468 * @type { OfflineResourceType } 3469 * @syscap SystemCapability.Web.Webview.Core 3470 * @since 12 3471 */ 3472 type: OfflineResourceType 3473 } 3474 3475 /** 3476 * Enum type supplied to {@link setScrollable} for indicating the type of scroll. 3477 * 3478 * @enum { number } 3479 * @syscap SystemCapability.Web.Webview.Core 3480 * @since 12 3481 */ 3482 enum ScrollType { 3483 /** 3484 * Indicates scrolling the web page through scroll event, include touch screen, touch pad, and mouse wheel. 3485 * 3486 * @syscap SystemCapability.Web.Webview.Core 3487 * @since 12 3488 */ 3489 EVENT 3490 } 3491 3492 /** 3493 * Provides methods for controlling the web controller. 3494 * @syscap SystemCapability.Web.Webview.Core 3495 * @since 9 3496 */ 3497 /** 3498 * Provides methods for controlling the web controller. 3499 * @syscap SystemCapability.Web.Webview.Core 3500 * @crossplatform 3501 * @since 10 3502 */ 3503 /** 3504 * Provides methods for controlling the web controller. 3505 * @syscap SystemCapability.Web.Webview.Core 3506 * @crossplatform 3507 * @atomicservice 3508 * @since 11 3509 */ 3510 class WebviewController { 3511 /** 3512 * A constructor used to create a WebviewController object. 3513 * 3514 * @param { string } [webTag] - specified the name of the web component, Empty by default. 3515 * @syscap SystemCapability.Web.Webview.Core 3516 * @atomicservice 3517 * @since 11 3518 */ 3519 constructor(webTag?: string); 3520 3521 /** 3522 * Initialize the web engine before loading the Web components. 3523 * This is a global static API that must be called on the UI thread, and it will have no effect if any 3524 * Web components are loaded. 3525 * @syscap SystemCapability.Web.Webview.Core 3526 * @since 9 3527 */ 3528 /** 3529 * Initialize the web engine before loading the Web components. 3530 * This is a global static API that must be called on the UI thread, and it will have no effect if any 3531 * Web components are loaded. 3532 * @syscap SystemCapability.Web.Webview.Core 3533 * @atomicservice 3534 * @since 11 3535 */ 3536 static initializeWebEngine(): void; 3537 3538 /** 3539 * Set web engine to use HttpDns server to resolve dns. 3540 * @param { SecureDnsMode } secureDnsMode - using HttpDns. 3541 * @param { string } secureDnsConfig - The configuration of the HttpDns server. 3542 * Must be https protocol and only allow one server to be configured. 3543 * @throws { BusinessError } 401 - Invalid input parameter. 3544 * @syscap SystemCapability.Web.Webview.Core 3545 * @since 10 3546 */ 3547 /** 3548 * Set web engine to use HttpDns server to resolve dns. 3549 * @param { SecureDnsMode } secureDnsMode - using HttpDns. 3550 * @param { string } secureDnsConfig - The configuration of the HttpDns server. 3551 * Must be https protocol and only allow one server to be configured. 3552 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 3553 * <br>2. Incorrect parameter types. 3. Parameter verification failed. 3554 * @syscap SystemCapability.Web.Webview.Core 3555 * @atomicservice 3556 * @since 11 3557 */ 3558 static setHttpDns(secureDnsMode: SecureDnsMode, secureDnsConfig: string): void; 3559 3560 /** 3561 * Enables debugging of web contents. 3562 * @param { boolean } webDebuggingAccess {@code true} enables debugging of web contents; {@code false} otherwise. 3563 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 3564 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 3565 * @syscap SystemCapability.Web.Webview.Core 3566 * @since 9 3567 */ 3568 /** 3569 * Enables debugging of web contents. 3570 * @param { boolean } webDebuggingAccess {@code true} enables debugging of web contents; {@code false} otherwise. 3571 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 3572 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 3573 * @syscap SystemCapability.Web.Webview.Core 3574 * @atomicservice 3575 * @since 11 3576 */ 3577 /** 3578 * Enables debugging of web contents. 3579 * @param { boolean } webDebuggingAccess {@code true} enables debugging of web contents; {@code false} otherwise. 3580 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 3581 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 3582 * @syscap SystemCapability.Web.Webview.Core 3583 * @crossplatform 3584 * @atomicservice 3585 * @since 18 3586 */ 3587 static setWebDebuggingAccess(webDebuggingAccess: boolean): void; 3588 3589 /** 3590 * Enable the ability to check website security risks. 3591 * Illegal and fraudulent websites are mandatory enabled and can't be disabled by this function. 3592 * @param { boolean } enable - {@code true} enable check the website security risks; {@code false} otherwise. 3593 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 3594 * <br>2. Incorrect parameter types. 3595 * @syscap SystemCapability.Web.Webview.Core 3596 * @atomicservice 3597 * @since 11 3598 */ 3599 enableSafeBrowsing(enable: boolean): void; 3600 3601 /** 3602 * Get whether checking website security risks is enabled. 3603 * @returns { boolean } True if enable the ability to check website security risks else false. 3604 * @syscap SystemCapability.Web.Webview.Core 3605 * @atomicservice 3606 * @since 11 3607 */ 3608 isSafeBrowsingEnabled(): boolean; 3609 3610 /** 3611 * Checks whether the web page can go forward. 3612 * @returns { boolean } True if the web page can go forward else false. 3613 * @throws { BusinessError } 17100001 - Init error. 3614 * The WebviewController must be associated with a Web component. 3615 * @syscap SystemCapability.Web.Webview.Core 3616 * @since 9 3617 */ 3618 /** 3619 * Checks whether the web page can go forward. 3620 * @returns { boolean } True if the web page can go forward else false. 3621 * @throws { BusinessError } 17100001 - Init error. 3622 * The WebviewController must be associated with a Web component. 3623 * @syscap SystemCapability.Web.Webview.Core 3624 * @crossplatform 3625 * @atomicservice 3626 * @since 11 3627 */ 3628 accessForward(): boolean; 3629 3630 /** 3631 * Checks whether the web page can go back. 3632 * @returns { boolean } True if the web page can go back else false. 3633 * @throws { BusinessError } 17100001 - Init error. 3634 * The WebviewController must be associated with a Web component. 3635 * @syscap SystemCapability.Web.Webview.Core 3636 * @since 9 3637 */ 3638 /** 3639 * Checks whether the web page can go back. 3640 * @returns { boolean } True if the web page can go back else false. 3641 * @throws { BusinessError } 17100001 - Init error. 3642 * The WebviewController must be associated with a Web component. 3643 * @syscap SystemCapability.Web.Webview.Core 3644 * @crossplatform 3645 * @atomicservice 3646 * @since 11 3647 */ 3648 accessBackward(): boolean; 3649 3650 /** 3651 * Checks whether the web page can go back or forward the given number of steps. 3652 * 3653 * @param { number } step - The number of steps. 3654 * @returns { boolean } True if the web page can go back else false. 3655 * @throws { BusinessError } 401 - Invalid input parameter. 3656 * @throws { BusinessError } 17100001 - Init error. 3657 * The WebviewController must be associated with a Web component. 3658 * @syscap SystemCapability.Web.Webview.Core 3659 * @since 9 3660 */ 3661 /** 3662 * Checks whether the web page can go back or forward the given number of steps. 3663 * 3664 * @param { number } step - The number of steps. 3665 * @returns { boolean } True if the web page can go back else false. 3666 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 3667 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 3668 * @throws { BusinessError } 17100001 - Init error. 3669 * The WebviewController must be associated with a Web component. 3670 * @syscap SystemCapability.Web.Webview.Core 3671 * @crossplatform 3672 * @atomicservice 3673 * @since 11 3674 */ 3675 accessStep(step: number): boolean; 3676 3677 /** 3678 * Goes forward in the history of the web page. 3679 * 3680 * @throws { BusinessError } 17100001 - Init error. 3681 * The WebviewController must be associated with a Web component. 3682 * @syscap SystemCapability.Web.Webview.Core 3683 * @since 9 3684 */ 3685 /** 3686 * Goes forward in the history of the web page. 3687 * 3688 * @throws { BusinessError } 17100001 - Init error. 3689 * The WebviewController must be associated with a Web component. 3690 * @syscap SystemCapability.Web.Webview.Core 3691 * @crossplatform 3692 * @atomicservice 3693 * @since 11 3694 */ 3695 forward(): void; 3696 3697 /** 3698 * Goes back in the history of the web page. 3699 * 3700 * @throws { BusinessError } 17100001 - Init error. 3701 * The WebviewController must be associated with a Web component. 3702 * @syscap SystemCapability.Web.Webview.Core 3703 * @since 9 3704 */ 3705 /** 3706 * Goes back in the history of the web page. 3707 * 3708 * @throws { BusinessError } 17100001 - Init error. 3709 * The WebviewController must be associated with a Web component. 3710 * @syscap SystemCapability.Web.Webview.Core 3711 * @crossplatform 3712 * @atomicservice 3713 * @since 11 3714 */ 3715 backward(): void; 3716 3717 /** 3718 * Clears the history in the Web. 3719 * 3720 * @throws { BusinessError } 17100001 - Init error. 3721 * The WebviewController must be associated with a Web component. 3722 * @syscap SystemCapability.Web.Webview.Core 3723 * @since 9 3724 */ 3725 /** 3726 * Clears the history in the Web. 3727 * 3728 * @throws { BusinessError } 17100001 - Init error. 3729 * The WebviewController must be associated with a Web component. 3730 * @syscap SystemCapability.Web.Webview.Core 3731 * @crossplatform 3732 * @atomicservice 3733 * @since 11 3734 */ 3735 clearHistory(): void; 3736 3737 /** 3738 * Let the Web active. 3739 * 3740 * @throws { BusinessError } 17100001 - Init error. 3741 * The WebviewController must be associated with a Web component. 3742 * @syscap SystemCapability.Web.Webview.Core 3743 * @since 9 3744 */ 3745 /** 3746 * Let the Web active. 3747 * 3748 * @throws { BusinessError } 17100001 - Init error. 3749 * The WebviewController must be associated with a Web component. 3750 * @syscap SystemCapability.Web.Webview.Core 3751 * @atomicservice 3752 * @since 11 3753 */ 3754 onActive(): void; 3755 3756 /** 3757 * Let the Web inactive. 3758 * 3759 * @throws { BusinessError } 17100001 - Init error. 3760 * The WebviewController must be associated with a Web component. 3761 * @syscap SystemCapability.Web.Webview.Core 3762 * @since 9 3763 */ 3764 /** 3765 * Let the Web inactive. 3766 * 3767 * @throws { BusinessError } 17100001 - Init error. 3768 * The WebviewController must be associated with a Web component. 3769 * @syscap SystemCapability.Web.Webview.Core 3770 * @atomicservice 3771 * @since 11 3772 */ 3773 onInactive(): void; 3774 3775 /** 3776 * Refreshes the current URL. 3777 * 3778 * @throws { BusinessError } 17100001 - Init error. 3779 * The WebviewController must be associated with a Web component. 3780 * @syscap SystemCapability.Web.Webview.Core 3781 * @since 9 3782 */ 3783 /** 3784 * Refreshes the current URL. 3785 * 3786 * @throws { BusinessError } 17100001 - Init error. 3787 * The WebviewController must be associated with a Web component. 3788 * @syscap SystemCapability.Web.Webview.Core 3789 * @crossplatform 3790 * @atomicservice 3791 * @since 11 3792 */ 3793 refresh(): void; 3794 3795 /** 3796 * Loads the data or URL. 3797 * 3798 * @param { string } data - A string encoded according to "Base64" or "URL". 3799 * @param { string } mimeType - Media type. For example: "text/html". 3800 * @param { string } encoding - Encoding type. For example: "UTF-8". 3801 * @param { string } [baseUrl] - A specified URL path ("http"/"https"/"data" protocol), 3802 * which is assigned to window.origin by the Web component. 3803 * @param { string } [historyUrl] - History URL. When it is not empty, it can be managed by 3804 * history records to realize the back and forth function. 3805 * This property is invalid when baseUrl is empty. 3806 * @throws { BusinessError } 401 - Invalid input parameter. 3807 * @throws { BusinessError } 17100001 - Init error. 3808 * The WebviewController must be associated with a Web component. 3809 * @throws { BusinessError } 17100002 - Invalid url. 3810 * @syscap SystemCapability.Web.Webview.Core 3811 * @since 9 3812 */ 3813 /** 3814 * Loads the data or URL. 3815 * 3816 * @param { string } data - A string encoded according to "Base64" or "URL". 3817 * @param { string } mimeType - Media type. For example: "text/html". 3818 * @param { string } encoding - Encoding type. For example: "UTF-8". 3819 * @param { string } [baseUrl] - A specified URL path ("http"/"https"/"data" protocol), 3820 * which is assigned to window.origin by the Web component. 3821 * @param { string } [historyUrl] - History URL. When it is not empty, it can be managed by 3822 * history records to realize the back and forth function. 3823 * This property is invalid when baseUrl is empty. 3824 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 3825 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 3826 * @throws { BusinessError } 17100001 - Init error. 3827 * The WebviewController must be associated with a Web component. 3828 * @syscap SystemCapability.Web.Webview.Core 3829 * @crossplatform 3830 * @atomicservice 3831 * @since 11 3832 */ 3833 loadData(data: string, mimeType: string, encoding: string, baseUrl?: string, historyUrl?: string): void; 3834 3835 /** 3836 * Loads the data or URL. 3837 * 3838 * @param { string | Resource } url - The URL to load. 3839 * @param { Array<WebHeader> } [headers] - Additional HTTP request header for URL. 3840 * @throws { BusinessError } 401 - Invalid input parameter. 3841 * @throws { BusinessError } 17100001 - Init error. 3842 * The WebviewController must be associated with a Web component. 3843 * @throws { BusinessError } 17100002 - Invalid url. 3844 * @throws { BusinessError } 17100003 - Invalid resource path or file type. 3845 * @syscap SystemCapability.Web.Webview.Core 3846 * @since 9 3847 */ 3848 /** 3849 * Loads the data or URL. 3850 * 3851 * @param { string | Resource } url - The URL to load. 3852 * @param { Array<WebHeader> } [headers] - Additional HTTP request header for URL. 3853 * @throws { BusinessError } 401 - Invalid input parameter. 3854 * @throws { BusinessError } 17100001 - Init error. 3855 * The WebviewController must be associated with a Web component. 3856 * @throws { BusinessError } 17100002 - Invalid url. 3857 * @throws { BusinessError } 17100003 - Invalid resource path or file type. 3858 * @syscap SystemCapability.Web.Webview.Core 3859 * @crossplatform 3860 * @since 10 3861 */ 3862 /** 3863 * Loads the data or URL. 3864 * 3865 * @param { string | Resource } url - The URL to load. 3866 * @param { Array<WebHeader> } [headers] - Additional HTTP request header for URL. 3867 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 3868 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 3869 * @throws { BusinessError } 17100001 - Init error. 3870 * The WebviewController must be associated with a Web component. 3871 * @throws { BusinessError } 17100002 - Invalid url. 3872 * @throws { BusinessError } 17100003 - Invalid resource path or file type. 3873 * @syscap SystemCapability.Web.Webview.Core 3874 * @crossplatform 3875 * @atomicservice 3876 * @since 11 3877 */ 3878 loadUrl(url: string | Resource, headers?: Array<WebHeader>): void; 3879 3880 /** 3881 * Gets the type of HitTest. 3882 * @returns { WebHitTestType } The type of HitTest. 3883 * @throws { BusinessError } 17100001 - Init error. 3884 * The WebviewController must be associated with a Web component. 3885 * @syscap SystemCapability.Web.Webview.Core 3886 * @since 9 3887 */ 3888 /** 3889 * Gets the type of HitTest. 3890 * @returns { WebHitTestType } The type of HitTest. 3891 * @throws { BusinessError } 17100001 - Init error. 3892 * The WebviewController must be associated with a Web component. 3893 * @syscap SystemCapability.Web.Webview.Core 3894 * @atomicservice 3895 * @since 11 3896 * @deprecated since 18 3897 * @useinstead ohos.web.webview.WebviewController#getLastHitTest 3898 */ 3899 getHitTest(): WebHitTestType; 3900 3901 /** 3902 * Stores the current page as a web archive. 3903 * 3904 * @param { string } baseName - Where the generated offline webpage is stored, This value cannot be null. 3905 * @param { boolean } autoName - Decide whether to automatically generate the file name. If false, it is 3906 * stored by the file name of baseName. If true, the file name is 3907 * automatically generated based on the current URL and stored in the file 3908 * directory of baseName. 3909 * @returns { Promise<string> } a promise resolved after the web archive has been stored. The parameter 3910 * will either be the filename under which the file was stored, or empty 3911 * if storing the file failed. 3912 * @throws { BusinessError } 401 - Invalid input parameter. 3913 * @throws { BusinessError } 17100001 - Init error. 3914 * The WebviewController must be associated with a Web component. 3915 * @throws { BusinessError } 17100003 - Invalid resource path or file type. 3916 * @syscap SystemCapability.Web.Webview.Core 3917 * @since 9 3918 */ 3919 /** 3920 * Stores the current page as a web archive. 3921 * 3922 * @param { string } baseName - Where the generated offline webpage is stored, This value cannot be null. 3923 * @param { boolean } autoName - Decide whether to automatically generate the file name. If false, it is 3924 * stored by the file name of baseName. If true, the file name is 3925 * automatically generated based on the current URL and stored in the file 3926 * directory of baseName. 3927 * @returns { Promise<string> } a promise resolved after the web archive has been stored. The parameter 3928 * will either be the filename under which the file was stored, or empty 3929 * if storing the file failed. 3930 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 3931 * <br>2. Incorrect parameter types. 3. Parameter verification failed. 3932 * @throws { BusinessError } 17100001 - Init error. 3933 * The WebviewController must be associated with a Web component. 3934 * @throws { BusinessError } 17100003 - Invalid resource path or file type. 3935 * @syscap SystemCapability.Web.Webview.Core 3936 * @atomicservice 3937 * @since 11 3938 */ 3939 storeWebArchive(baseName: string, autoName: boolean): Promise<string>; 3940 3941 /** 3942 * Stores the current page as a web archive. 3943 * 3944 * @param { string } baseName - Where the generated offline webpage is stored, This value cannot be null. 3945 * @param { boolean } autoName - Decide whether to automatically generate the file name. If false, it is 3946 * stored by the file name of baseName. If true, the file name is 3947 * automatically generated based on the current URL and stored in the file 3948 * directory of baseName. 3949 * @param { AsyncCallback<string> } callback - called after the web archive has been stored. The parameter 3950 * will either be the filename under which the file was stored, 3951 * or empty if storing the file failed. 3952 * @throws { BusinessError } 401 - Invalid input parameter. 3953 * @throws { BusinessError } 17100001 - Init error. 3954 * The WebviewController must be associated with a Web component. 3955 * @throws { BusinessError } 17100003 - Invalid resource path or file type. 3956 * @syscap SystemCapability.Web.Webview.Core 3957 * @since 9 3958 */ 3959 /** 3960 * Stores the current page as a web archive. 3961 * 3962 * @param { string } baseName - Where the generated offline webpage is stored, This value cannot be null. 3963 * @param { boolean } autoName - Decide whether to automatically generate the file name. If false, it is 3964 * stored by the file name of baseName. If true, the file name is 3965 * automatically generated based on the current URL and stored in the file 3966 * directory of baseName. 3967 * @param { AsyncCallback<string> } callback - called after the web archive has been stored. The parameter 3968 * will either be the filename under which the file was stored, 3969 * or empty if storing the file failed. 3970 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 3971 * <br>2. Incorrect parameter types. 3. Parameter verification failed. 3972 * @throws { BusinessError } 17100001 - Init error. 3973 * The WebviewController must be associated with a Web component. 3974 * @throws { BusinessError } 17100003 - Invalid resource path or file type. 3975 * @syscap SystemCapability.Web.Webview.Core 3976 * @atomicservice 3977 * @since 11 3978 */ 3979 storeWebArchive(baseName: string, autoName: boolean, callback: AsyncCallback<string>): void; 3980 3981 /** 3982 * Let the Web zoom by. 3983 * 3984 * @param { number } factor - The zoom factor. 3985 * @throws { BusinessError } 401 - Invalid input parameter. 3986 * @throws { BusinessError } 17100001 - Init error. 3987 * The WebviewController must be associated with a Web component. 3988 * @throws { BusinessError } 17100004 - Function not enabled. 3989 * @syscap SystemCapability.Web.Webview.Core 3990 * @since 9 3991 */ 3992 /** 3993 * Let the Web zoom by. 3994 * 3995 * @param { number } factor - The zoom factor. 3996 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 3997 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 3998 * @throws { BusinessError } 17100001 - Init error. 3999 * The WebviewController must be associated with a Web component. 4000 * @throws { BusinessError } 17100004 - Function not enabled. 4001 * @syscap SystemCapability.Web.Webview.Core 4002 * @crossplatform 4003 * @atomicservice 4004 * @since 11 4005 */ 4006 zoom(factor: number): void; 4007 4008 /** 4009 * Let the Web zoom in. 4010 * 4011 * @throws { BusinessError } 17100001 - Init error. 4012 * The WebviewController must be associated with a Web component. 4013 * @throws { BusinessError } 17100004 - Function not enabled. 4014 * @syscap SystemCapability.Web.Webview.Core 4015 * @since 9 4016 */ 4017 /** 4018 * Let the Web zoom in. 4019 * 4020 * @throws { BusinessError } 17100001 - Init error. 4021 * The WebviewController must be associated with a Web component. 4022 * @throws { BusinessError } 17100004 - Function not enabled. 4023 * @syscap SystemCapability.Web.Webview.Core 4024 * @atomicservice 4025 * @since 11 4026 */ 4027 /** 4028 * Let the Web zoom in. 4029 * 4030 * @throws { BusinessError } 17100001 - Init error. 4031 * The WebviewController must be associated with a Web component. 4032 * @throws { BusinessError } 17100004 - Function not enabled. 4033 * @syscap SystemCapability.Web.Webview.Core 4034 * @crossplatform 4035 * @atomicservice 4036 * @since 18 4037 */ 4038 zoomIn(): void; 4039 4040 /** 4041 * Let the Web zoom out. 4042 * 4043 * @throws { BusinessError } 17100001 - Init error. 4044 * The WebviewController must be associated with a Web component. 4045 * @throws { BusinessError } 17100004 - Function not enabled. 4046 * @syscap SystemCapability.Web.Webview.Core 4047 * @since 9 4048 */ 4049 /** 4050 * Let the Web zoom out. 4051 * 4052 * @throws { BusinessError } 17100001 - Init error. 4053 * The WebviewController must be associated with a Web component. 4054 * @throws { BusinessError } 17100004 - Function not enabled. 4055 * @syscap SystemCapability.Web.Webview.Core 4056 * @atomicservice 4057 * @since 11 4058 */ 4059 /** 4060 * Let the Web zoom out. 4061 * 4062 * @throws { BusinessError } 17100001 - Init error. 4063 * The WebviewController must be associated with a Web component. 4064 * @throws { BusinessError } 17100004 - Function not enabled. 4065 * @syscap SystemCapability.Web.Webview.Core 4066 * @crossplatform 4067 * @atomicservice 4068 * @since 18 4069 */ 4070 zoomOut(): void; 4071 4072 /** 4073 * Gets the hit test value of HitTest. 4074 * @returns { HitTestValue } Return the element information of the clicked area. 4075 * @throws { BusinessError } 17100001 - Init error. 4076 * The WebviewController must be associated with a Web component. 4077 * @syscap SystemCapability.Web.Webview.Core 4078 * @since 9 4079 */ 4080 /** 4081 * Gets the hit test value of HitTest. 4082 * @returns { HitTestValue } Return the element information of the clicked area. 4083 * @throws { BusinessError } 17100001 - Init error. 4084 * The WebviewController must be associated with a Web component. 4085 * @syscap SystemCapability.Web.Webview.Core 4086 * @atomicservice 4087 * @since 11 4088 * @deprecated since 18 4089 * @useinstead ohos.web.webview.WebviewController#getLastHitTest 4090 */ 4091 getHitTestValue(): HitTestValue; 4092 4093 /** 4094 * Gets the id for the current Web. 4095 * @returns { number } Returns the index value of the current Web component. 4096 * @throws { BusinessError } 17100001 - Init error. 4097 * The WebviewController must be associated with a Web component. 4098 * @syscap SystemCapability.Web.Webview.Core 4099 * @since 9 4100 */ 4101 /** 4102 * Gets the id for the current Web. 4103 * @returns { number } Returns the index value of the current Web component. 4104 * @throws { BusinessError } 17100001 - Init error. 4105 * The WebviewController must be associated with a Web component. 4106 * @syscap SystemCapability.Web.Webview.Core 4107 * @atomicservice 4108 * @since 11 4109 */ 4110 /** 4111 * Gets the id for the current Web. 4112 * @returns { number } Returns the index value of the current Web component. 4113 * @throws { BusinessError } 17100001 - Init error. 4114 * The WebviewController must be associated with a Web component. 4115 * @syscap SystemCapability.Web.Webview.Core 4116 * @crossplatform 4117 * @atomicservice 4118 * @since 18 4119 */ 4120 getWebId(): number; 4121 4122 /** 4123 * Gets the default user agent. 4124 * @returns { string } Return user agent information. 4125 * @throws { BusinessError } 17100001 - Init error. 4126 * The WebviewController must be associated with a Web component. 4127 * @syscap SystemCapability.Web.Webview.Core 4128 * @since 9 4129 */ 4130 /** 4131 * Gets the default user agent. 4132 * @returns { string } Return user agent information. 4133 * @throws { BusinessError } 17100001 - Init error. 4134 * The WebviewController must be associated with a Web component. 4135 * @syscap SystemCapability.Web.Webview.Core 4136 * @atomicservice 4137 * @since 11 4138 */ 4139 getUserAgent(): string; 4140 4141 /** 4142 * Gets the title of current Web page. 4143 * @returns { string } Return to File Selector Title. 4144 * @throws { BusinessError } 17100001 - Init error. 4145 * The WebviewController must be associated with a Web component. 4146 * @syscap SystemCapability.Web.Webview.Core 4147 * @since 9 4148 */ 4149 /** 4150 * Gets the title of current Web page. 4151 * @returns { string } Return to File Selector Title. 4152 * @throws { BusinessError } 17100001 - Init error. 4153 * The WebviewController must be associated with a Web component. 4154 * @syscap SystemCapability.Web.Webview.Core 4155 * @crossplatform 4156 * @atomicservice 4157 * @since 11 4158 */ 4159 getTitle(): string; 4160 4161 /** 4162 * Gets the content height of current Web page. 4163 * @returns { number } Returns the page height of the current page. 4164 * @throws { BusinessError } 17100001 - Init error. 4165 * The WebviewController must be associated with a Web component. 4166 * @syscap SystemCapability.Web.Webview.Core 4167 * @since 9 4168 */ 4169 /** 4170 * Gets the content height of current Web page. 4171 * @returns { number } Returns the page height of the current page. 4172 * @throws { BusinessError } 17100001 - Init error. 4173 * The WebviewController must be associated with a Web component. 4174 * @syscap SystemCapability.Web.Webview.Core 4175 * @crossplatform 4176 * @atomicservice 4177 * @since 11 4178 */ 4179 getPageHeight(): number; 4180 4181 /** 4182 * Goes forward or back backOrForward in the history of the web page. 4183 * 4184 * @param { number } step - Steps to go forward or backward. 4185 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 4186 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 4187 * @throws { BusinessError } 17100001 - Init error. 4188 * The WebviewController must be associated with a Web component. 4189 * @syscap SystemCapability.Web.Webview.Core 4190 * @since 9 4191 */ 4192 /** 4193 * Goes forward or back backOrForward in the history of the web page. 4194 * 4195 * @param { number } step - Steps to go forward or backward. 4196 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 4197 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 4198 * @throws { BusinessError } 17100001 - Init error. 4199 * The WebviewController must be associated with a Web component. 4200 * @syscap SystemCapability.Web.Webview.Core 4201 * @crossplatform 4202 * @atomicservice 4203 * @since 11 4204 */ 4205 backOrForward(step: number): void; 4206 4207 /** 4208 * Gets the request focus. 4209 * 4210 * @throws { BusinessError } 17100001 - Init error. 4211 * The WebviewController must be associated with a Web component. 4212 * @syscap SystemCapability.Web.Webview.Core 4213 * @since 9 4214 */ 4215 /** 4216 * Gets the request focus. 4217 * 4218 * @throws { BusinessError } 17100001 - Init error. 4219 * The WebviewController must be associated with a Web component. 4220 * @syscap SystemCapability.Web.Webview.Core 4221 * @atomicservice 4222 * @since 11 4223 */ 4224 requestFocus(): void; 4225 4226 /** 4227 * Create web message ports 4228 * @returns { Array<WebMessagePort> } An array represent 2 WebMessagePort, then can use 4229 * those ports to communication with html pages. 4230 * @throws { BusinessError } 17100001 - Init error. 4231 * The WebviewController must be associated with a Web component. 4232 * @syscap SystemCapability.Web.Webview.Core 4233 * @since 9 4234 */ 4235 /** 4236 * Create web message ports 4237 * @param { boolean } isExtentionType - Set whether the web message port supports extention type. 4238 * @returns { Array<WebMessagePort> } An array represent 2 WebMessagePort, then can use 4239 * those ports to communication with html pages. 4240 * @throws { BusinessError } 401 - Invalid input parameter. 4241 * @throws { BusinessError } 17100001 - Init error. 4242 * The WebviewController must be associated with a Web component. 4243 * @syscap SystemCapability.Web.Webview.Core 4244 * @since 10 4245 */ 4246 /** 4247 * Create web message ports 4248 * @param { boolean } isExtentionType - Set whether the web message port supports extention type. 4249 * @returns { Array<WebMessagePort> } An array represent 2 WebMessagePort, then can use 4250 * those ports to communication with html pages. 4251 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 4252 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 4253 * @throws { BusinessError } 17100001 - Init error. 4254 * The WebviewController must be associated with a Web component. 4255 * @syscap SystemCapability.Web.Webview.Core 4256 * @crossplatform 4257 * @atomicservice 4258 * @since 11 4259 */ 4260 createWebMessagePorts(isExtentionType?: boolean): Array<WebMessagePort>; 4261 4262 /** 4263 * Post web message port to html 4264 * 4265 * @param { string } name - Data name information to send. 4266 * @param { Array<WebMessagePort> } ports - Port number array information to send. 4267 * @param { string } uri - URI to receive this information. 4268 * @throws { BusinessError } 401 - Invalid input parameter. 4269 * @throws { BusinessError } 17100001 - Init error. 4270 * The WebviewController must be associated with a Web component. 4271 * @syscap SystemCapability.Web.Webview.Core 4272 * @since 9 4273 */ 4274 /** 4275 * Post web message port to html 4276 * 4277 * @param { string } name - Data name information to send. 4278 * @param { Array<WebMessagePort> } ports - Port number array information to send. 4279 * @param { string } uri - URI to receive this information. 4280 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 4281 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 4282 * @throws { BusinessError } 17100001 - Init error. 4283 * The WebviewController must be associated with a Web component. 4284 * @syscap SystemCapability.Web.Webview.Core 4285 * @crossplatform 4286 * @atomicservice 4287 * @since 11 4288 */ 4289 postMessage(name: string, ports: Array<WebMessagePort>, uri: string): void; 4290 4291 /** 4292 * Stops the current load. 4293 * 4294 * @throws { BusinessError } 17100001 - Init error. 4295 * The WebviewController must be associated with a Web component. 4296 * @syscap SystemCapability.Web.Webview.Core 4297 * @since 9 4298 */ 4299 /** 4300 * Stops the current load. 4301 * 4302 * @throws { BusinessError } 17100001 - Init error. 4303 * The WebviewController must be associated with a Web component. 4304 * @syscap SystemCapability.Web.Webview.Core 4305 * @crossplatform 4306 * @atomicservice 4307 * @since 11 4308 */ 4309 stop(): void; 4310 4311 /** 4312 * Registers the JavaScript object and method list. 4313 * 4314 * @param { object } object - Application side JavaScript objects participating in registration. 4315 * @param { string } name - The name of the registered object, which is consistent with the 4316 * object name called in the window. 4317 * @param { Array<string> } methodList - Thr method of the application side JavaScript object participating 4318 * in the registration. 4319 * @throws { BusinessError } 401 - Invalid input parameter. 4320 * @throws { BusinessError } 17100001 - Init error. 4321 * The WebviewController must be associated with a Web component. 4322 * @syscap SystemCapability.Web.Webview.Core 4323 * @since 9 4324 */ 4325 /** 4326 * Registers the JavaScript object and method list. 4327 * 4328 * @param { object } object - Application side JavaScript objects participating in registration. 4329 * @param { string } name - The name of the registered object, which is consistent with the 4330 * object name called in the window. 4331 * @param { Array<string> } methodList - Thr method of the application side JavaScript object participating 4332 * in the registration. 4333 * @throws { BusinessError } 401 - Invalid input parameter. 4334 * @throws { BusinessError } 17100001 - Init error. 4335 * The WebviewController must be associated with a Web component. 4336 * @syscap SystemCapability.Web.Webview.Core 4337 * @atomicservice 4338 * @since 11 4339 */ 4340 /** 4341 * Registers the JavaScript object and method list. 4342 * 4343 * @param { object } object - Application side JavaScript objects participating in registration. 4344 * @param { string } name - The name of the registered object, which is consistent with the 4345 * object name called in the window. 4346 * @param { Array<string> } methodList - The method of the application side JavaScript object participating 4347 * in the registration. 4348 * @param { Array<string> } [asyncMethodList] - The async method of the application side JavaScript object 4349 * participating in the registration. 4350 * @param { string } [permission] - permission configuration defining web page URLs that can access JavaScriptProxy methods. 4351 * The configuration can be defined at two levels, object level and method level. 4352 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 4353 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 4354 * @throws { BusinessError } 17100001 - Init error. 4355 * The WebviewController must be associated with a Web component. 4356 * @syscap SystemCapability.Web.Webview.Core 4357 * @atomicservice 4358 * @since 12 4359 */ 4360 registerJavaScriptProxy(object: object, name: string, methodList: Array<string>, 4361 asyncMethodList?: Array<string>, permission?: string): void; 4362 4363 /** 4364 * Deletes a registered JavaScript object with given name. 4365 * 4366 * @param { string } name - The name of a registered JavaScript object to be deleted. 4367 * @throws { BusinessError } 401 - Invalid input parameter. 4368 * @throws { BusinessError } 17100001 - Init error. 4369 * The WebviewController must be associated with a Web component. 4370 * @throws { BusinessError } 17100008 - Failed to delete JavaScriptProxy because it does not exist. 4371 * @syscap SystemCapability.Web.Webview.Core 4372 * @since 9 4373 */ 4374 /** 4375 * Deletes a registered JavaScript object with given name. 4376 * 4377 * @param { string } name - The name of a registered JavaScript object to be deleted. 4378 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 4379 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 4380 * @throws { BusinessError } 17100001 - Init error. 4381 * The WebviewController must be associated with a Web component. 4382 * @throws { BusinessError } 17100008 - Failed to delete JavaScriptProxy because it does not exist. 4383 * @syscap SystemCapability.Web.Webview.Core 4384 * @atomicservice 4385 * @since 11 4386 */ 4387 deleteJavaScriptRegister(name: string): void; 4388 4389 /** 4390 * Search all instances of 'searchString' on the page and highlights them, 4391 * result will be notify through callback onSearchResultReceive. 4392 * 4393 * @param { string } searchString - String to be search. 4394 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 4395 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 4396 * @throws { BusinessError } 17100001 - Init error. 4397 * The WebviewController must be associated with a Web component. 4398 * @syscap SystemCapability.Web.Webview.Core 4399 * @since 9 4400 */ 4401 /** 4402 * Search all instances of 'searchString' on the page and highlights them, 4403 * result will be notify through callback onSearchResultReceive. 4404 * 4405 * @param { string } searchString - String to be search. 4406 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 4407 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 4408 * @throws { BusinessError } 17100001 - Init error. 4409 * The WebviewController must be associated with a Web component. 4410 * @syscap SystemCapability.Web.Webview.Core 4411 * @atomicservice 4412 * @since 11 4413 */ 4414 searchAllAsync(searchString: string): void; 4415 4416 /** 4417 * Clears the highlighting surrounding text matches created by searchAllAsync. 4418 * 4419 * @throws { BusinessError } 17100001 - Init error. 4420 * The WebviewController must be associated with a Web component. 4421 * @syscap SystemCapability.Web.Webview.Core 4422 * @since 9 4423 */ 4424 /** 4425 * Clears the highlighting surrounding text matches created by searchAllAsync. 4426 * 4427 * @throws { BusinessError } 17100001 - Init error. 4428 * The WebviewController must be associated with a Web component. 4429 * @syscap SystemCapability.Web.Webview.Core 4430 * @atomicservice 4431 * @since 11 4432 */ 4433 clearMatches(): void; 4434 4435 /** 4436 * Highlights and scrolls to the next match search. 4437 * 4438 * @param { boolean } forward - Step of search is back or forward. 4439 * @throws { BusinessError } 401 - Invalid input parameter. 4440 * @throws { BusinessError } 17100001 - Init error. 4441 * The WebviewController must be associated with a Web component. 4442 * @syscap SystemCapability.Web.Webview.Core 4443 * @since 9 4444 */ 4445 /** 4446 * Highlights and scrolls to the next match search. 4447 * 4448 * @param { boolean } forward - Step of search is back or forward. 4449 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 4450 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 4451 * @throws { BusinessError } 17100001 - Init error. 4452 * The WebviewController must be associated with a Web component. 4453 * @syscap SystemCapability.Web.Webview.Core 4454 * @atomicservice 4455 * @since 11 4456 */ 4457 searchNext(forward: boolean): void; 4458 4459 /** 4460 * Clears the ssl cache in the Web. 4461 * 4462 * @throws { BusinessError } 17100001 - Init error. 4463 * The WebviewController must be associated with a Web component. 4464 * @syscap SystemCapability.Web.Webview.Core 4465 * @since 9 4466 */ 4467 /** 4468 * Clears the ssl cache in the Web. 4469 * 4470 * @throws { BusinessError } 17100001 - Init error. 4471 * The WebviewController must be associated with a Web component. 4472 * @syscap SystemCapability.Web.Webview.Core 4473 * @atomicservice 4474 * @since 11 4475 */ 4476 clearSslCache(): void; 4477 4478 /** 4479 * Clears the client authentication certificate cache in the Web. 4480 * 4481 * @throws { BusinessError } 17100001 - Init error. 4482 * The WebviewController must be associated with a Web component. 4483 * @syscap SystemCapability.Web.Webview.Core 4484 * @since 9 4485 */ 4486 /** 4487 * Clears the client authentication certificate cache in the Web. 4488 * 4489 * @throws { BusinessError } 17100001 - Init error. 4490 * The WebviewController must be associated with a Web component. 4491 * @syscap SystemCapability.Web.Webview.Core 4492 * @atomicservice 4493 * @since 11 4494 */ 4495 clearClientAuthenticationCache(): void; 4496 4497 /** 4498 * Loads a piece of code and execute JS code in the context of the currently displayed page. 4499 * 4500 * @param { string } script - JavaScript Script. 4501 * @returns { Promise<string> } A promise is solved after the JavaScript script is executed. 4502 * This parameter will be the result of JavaScript script execution. 4503 * If the JavaScript script fails to execute or has no return value, 4504 * null will be returned. 4505 * @throws { BusinessError } 401 - Invalid input parameter. 4506 * @throws { BusinessError } 17100001 - Init error. 4507 * The WebviewController must be associated with a Web component. 4508 * @syscap SystemCapability.Web.Webview.Core 4509 * @since 9 4510 */ 4511 /** 4512 * Loads a piece of code and execute JS code in the context of the currently displayed page. 4513 * 4514 * @param { string } script - JavaScript Script. 4515 * @returns { Promise<string> } A promise is solved after the JavaScript script is executed. 4516 * This parameter will be the result of JavaScript script execution. 4517 * If the JavaScript script fails to execute or has no return value, 4518 * null will be returned. 4519 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 4520 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 4521 * @throws { BusinessError } 17100001 - Init error. 4522 * The WebviewController must be associated with a Web component. 4523 * @syscap SystemCapability.Web.Webview.Core 4524 * @crossplatform 4525 * @atomicservice 4526 * @since 11 4527 */ 4528 runJavaScript(script: string): Promise<string>; 4529 4530 /** 4531 * Loads a piece of code and execute JS code in the context of the currently displayed page. 4532 * 4533 * @param { string } script - JavaScript Script. 4534 * @param { AsyncCallback<string> } callback - Callbacks execute JavaScript script results. 4535 * @throws { BusinessError } 401 - Invalid input parameter. 4536 * @throws { BusinessError } 17100001 - Init error. 4537 * The WebviewController must be associated with a Web component. 4538 * @syscap SystemCapability.Web.Webview.Core 4539 * @since 9 4540 */ 4541 /** 4542 * Loads a piece of code and execute JS code in the context of the currently displayed page. 4543 * 4544 * @param { string } script - JavaScript Script. 4545 * @param { AsyncCallback<string> } callback - Callbacks execute JavaScript script results. 4546 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 4547 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 4548 * @throws { BusinessError } 17100001 - Init error. 4549 * The WebviewController must be associated with a Web component. 4550 * @syscap SystemCapability.Web.Webview.Core 4551 * @crossplatform 4552 * @atomicservice 4553 * @since 11 4554 */ 4555 runJavaScript(script: string, callback: AsyncCallback<string>): void; 4556 4557 /** 4558 * Execute JavaScript code in the context of the currently displayed page, and return the result. 4559 * 4560 * @param { string } script - JavaScript Script. 4561 * @returns { Promise<JsMessageExt> } A promise is solved after the JavaScript script is executed. 4562 * This parameter will be the result of JavaScript script execution. 4563 * If the JavaScript script fails to execute or has no return value, 4564 * a none type value will be returned. 4565 * @throws { BusinessError } 401 - Invalid input parameter. 4566 * @throws { BusinessError } 17100001 - Init error. 4567 * The WebviewController must be associated with a Web component. 4568 * @syscap SystemCapability.Web.Webview.Core 4569 * @since 10 4570 */ 4571 /** 4572 * Execute JavaScript code in the context of the currently displayed page, and return the result. 4573 * 4574 * @param { string } script - JavaScript Script. 4575 * @returns { Promise<JsMessageExt> } A promise is solved after the JavaScript script is executed. 4576 * This parameter will be the result of JavaScript script execution. 4577 * If the JavaScript script fails to execute or has no return value, 4578 * a none type value will be returned. 4579 * @throws { BusinessError } 401 - Invalid input parameter. 4580 * @throws { BusinessError } 17100001 - Init error. 4581 * The WebviewController must be associated with a Web component. 4582 * @syscap SystemCapability.Web.Webview.Core 4583 * @atomicservice 4584 * @since 11 4585 */ 4586 /** 4587 * Execute JavaScript code in the context of the currently displayed page, and return the result. 4588 * 4589 * @param { string | ArrayBuffer } script - JavaScript Script. 4590 * @returns { Promise<JsMessageExt> } A promise is solved after the JavaScript script is executed. 4591 * This parameter will be the result of JavaScript script execution. 4592 * If the JavaScript script fails to execute or has no return value, 4593 * a none type value will be returned. 4594 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 4595 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 4596 * @throws { BusinessError } 17100001 - Init error. 4597 * The WebviewController must be associated with a Web component. 4598 * @syscap SystemCapability.Web.Webview.Core 4599 * @atomicservice 4600 * @since 12 4601 */ 4602 /** 4603 * Execute JavaScript code in the context of the currently displayed page, and return the result. 4604 * 4605 * @param { string | ArrayBuffer } script - JavaScript Script. 4606 * @returns { Promise<JsMessageExt> } A promise is solved after the JavaScript script is executed. 4607 * This parameter will be the result of JavaScript script execution. 4608 * If the JavaScript script fails to execute or has no return value, 4609 * a none type value will be returned. 4610 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 4611 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 4612 * @throws { BusinessError } 17100001 - Init error. 4613 * The WebviewController must be associated with a Web component. 4614 * @syscap SystemCapability.Web.Webview.Core 4615 * @crossplatform 4616 * @atomicservice 4617 * @since 18 4618 */ 4619 runJavaScriptExt(script: string | ArrayBuffer): Promise<JsMessageExt>; 4620 4621 /** 4622 * Execute JavaScript code in the context of the currently displayed page, and return the result. 4623 * 4624 * @param { string } script - JavaScript Script. 4625 * @param { AsyncCallback<JsMessageExt> } callback - Callbacks execute JavaScript script results. 4626 * @throws { BusinessError } 401 - Invalid input parameter. 4627 * @throws { BusinessError } 17100001 - Init error. 4628 * The WebviewController must be associated with a Web component. 4629 * @syscap SystemCapability.Web.Webview.Core 4630 * @since 10 4631 */ 4632 /** 4633 * Execute JavaScript code in the context of the currently displayed page, and return the result. 4634 * 4635 * @param { string } script - JavaScript Script. 4636 * @param { AsyncCallback<JsMessageExt> } callback - Callbacks execute JavaScript script results. 4637 * @throws { BusinessError } 401 - Invalid input parameter. 4638 * @throws { BusinessError } 17100001 - Init error. 4639 * The WebviewController must be associated with a Web component. 4640 * @syscap SystemCapability.Web.Webview.Core 4641 * @atomicservice 4642 * @since 11 4643 */ 4644 /** 4645 * Execute JavaScript code in the context of the currently displayed page, and return the result. 4646 * 4647 * @param { string | ArrayBuffer } script - JavaScript Script. 4648 * @param { AsyncCallback<JsMessageExt> } callback - Callbacks execute JavaScript script results. 4649 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 4650 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 4651 * @throws { BusinessError } 17100001 - Init error. 4652 * The WebviewController must be associated with a Web component. 4653 * @syscap SystemCapability.Web.Webview.Core 4654 * @atomicservice 4655 * @since 12 4656 */ 4657 /** 4658 * Execute JavaScript code in the context of the currently displayed page, and return the result. 4659 * 4660 * @param { string | ArrayBuffer } script - JavaScript Script. 4661 * @param { AsyncCallback<JsMessageExt> } callback - Callbacks execute JavaScript script results. 4662 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 4663 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 4664 * @throws { BusinessError } 17100001 - Init error. 4665 * The WebviewController must be associated with a Web component. 4666 * @syscap SystemCapability.Web.Webview.Core 4667 * @crossplatform 4668 * @atomicservice 4669 * @since 18 4670 */ 4671 runJavaScriptExt(script: string | ArrayBuffer, callback: AsyncCallback<JsMessageExt>): void; 4672 4673 /** 4674 * Rendering current Web page into Pdf data, return the result in async mode. 4675 * 4676 * @param { PdfConfiguration } configuration - configuration for createPdf, 4677 * including page width and height, etc. 4678 * {@Link PdfConfiguration} 4679 * @param { AsyncCallback<PdfData> } callback - Callbacks execute createPdf results. 4680 * PdfData is pdf data stream of current web page in Uint8Array 4681 * {@Link PdfData}. 4682 * @throws { BusinessError } 401 - Invalid input parameter. 4683 * @throws { BusinessError } 17100001 - Init error. 4684 * The WebviewController must be associated with a Web component. 4685 * @syscap SystemCapability.Web.Webview.Core 4686 * @atomicservice 4687 * @since 14 4688 */ 4689 createPdf(configuration: PdfConfiguration, callback: AsyncCallback<PdfData>): void; 4690 4691 /** 4692 * Rendering current Web page into Pdf data, return the result in promise mode. 4693 * 4694 * @param { PdfConfiguration } configuration - configuration for createPdf, 4695 * including page width and height, etc. 4696 * {@Link PdfConfiguration} 4697 * @returns { Promise<PdfData> } The promise returned by the function. 4698 * PdfData is pdf data stream of current web page in Uint8Array 4699 * {@Link PdfData}. 4700 * If createPdf fails or no return value, 4701 * a none type value will be returned. 4702 * @throws { BusinessError } 401 - Invalid input parameter. 4703 * @throws { BusinessError } 17100001 - Init error. 4704 * The WebviewController must be associated with a Web component. 4705 * @syscap SystemCapability.Web.Webview.Core 4706 * @atomicservice 4707 * @since 14 4708 */ 4709 createPdf(configuration: PdfConfiguration): Promise<PdfData>; 4710 4711 /** 4712 * Gets the url of current Web page. 4713 * @returns { string } Return the url of the current page. 4714 * @throws { BusinessError } 17100001 - Init error. 4715 * The WebviewController must be associated with a Web component. 4716 * @syscap SystemCapability.Web.Webview.Core 4717 * @since 9 4718 */ 4719 /** 4720 * Gets the url of current Web page. 4721 * @returns { string } Return the url of the current page. 4722 * @throws { BusinessError } 17100001 - Init error. 4723 * The WebviewController must be associated with a Web component. 4724 * @syscap SystemCapability.Web.Webview.Core 4725 * @crossplatform 4726 * @atomicservice 4727 * @since 11 4728 */ 4729 getUrl(): string; 4730 4731 /** 4732 * Scroll the contents of this Webview up by half the view size. 4733 * 4734 * @param { boolean } top - Whether to jump to the top of the page, if set to false, 4735 * the page content will scroll up half the size of the viewframe, 4736 * and when set to true, it will jump to the top of the page. 4737 * @throws { BusinessError } 401 - Invalid input parameter. 4738 * @throws { BusinessError } 17100001 - Init error. 4739 * The WebviewController must be associated with a Web component. 4740 * @syscap SystemCapability.Web.Webview.Core 4741 * @since 9 4742 */ 4743 /** 4744 * Scroll the contents of this Webview up by half the view size. 4745 * 4746 * @param { boolean } top - Whether to jump to the top of the page, if set to false, 4747 * the page content will scroll up half the size of the viewframe, 4748 * and when set to true, it will jump to the top of the page. 4749 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 4750 * <br>2. Incorrect parameter types. 4751 * @throws { BusinessError } 17100001 - Init error. 4752 * The WebviewController must be associated with a Web component. 4753 * @syscap SystemCapability.Web.Webview.Core 4754 * @atomicservice 4755 * @since 11 4756 */ 4757 /** 4758 * Scroll the contents of this Webview up by half the view size. 4759 * 4760 * @param { boolean } top - Whether to jump to the top of the page, if set to false, 4761 * the page content will scroll up half the size of the viewframe, 4762 * and when set to true, it will jump to the top of the page. 4763 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 4764 * <br>2. Incorrect parameter types. 4765 * @throws { BusinessError } 17100001 - Init error. 4766 * The WebviewController must be associated with a Web component. 4767 * @syscap SystemCapability.Web.Webview.Core 4768 * @crossplatform 4769 * @atomicservice 4770 * @since 18 4771 */ 4772 pageUp(top: boolean): void; 4773 4774 /** 4775 * Scroll the contents of this Webview down by half the view size. 4776 * 4777 * @param { boolean } bottom - Whether to jump to the top of the page, if set to false, 4778 * the page content will scroll up half the size of the viewframe, 4779 * and when set to true, it will jump to the top of the page. 4780 * @throws { BusinessError } 401 - Invalid input parameter. 4781 * @throws { BusinessError } 17100001 - Init error. 4782 * The WebviewController must be associated with a Web component. 4783 * @syscap SystemCapability.Web.Webview.Core 4784 * @since 9 4785 */ 4786 /** 4787 * Scroll the contents of this Webview down by half the view size. 4788 * 4789 * @param { boolean } bottom - Whether to jump to the top of the page, if set to false, 4790 * the page content will scroll up half the size of the viewframe, 4791 * and when set to true, it will jump to the top of the page. 4792 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 4793 * <br>2. Incorrect parameter types. 4794 * @throws { BusinessError } 17100001 - Init error. 4795 * The WebviewController must be associated with a Web component. 4796 * @syscap SystemCapability.Web.Webview.Core 4797 * @atomicservice 4798 * @since 11 4799 */ 4800 /** 4801 * Scroll the contents of this Webview down by half the view size. 4802 * 4803 * @param { boolean } bottom - Whether to jump to the top of the page, if set to false, 4804 * the page content will scroll up half the size of the viewframe, 4805 * and when set to true, it will jump to the top of the page. 4806 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 4807 * <br>2. Incorrect parameter types. 4808 * @throws { BusinessError } 17100001 - Init error. 4809 * The WebviewController must be associated with a Web component. 4810 * @syscap SystemCapability.Web.Webview.Core 4811 * @crossplatform 4812 * @atomicservice 4813 * @since 18 4814 */ 4815 pageDown(bottom: boolean): void; 4816 4817 /** 4818 * Gets the original url of current Web page. 4819 * @returns { string } Return the original url of the current page. 4820 * @throws { BusinessError } 17100001 - Init error. 4821 * The WebviewController must be associated with a Web component. 4822 * @syscap SystemCapability.Web.Webview.Core 4823 * @since 9 4824 */ 4825 /** 4826 * Gets the original url of current Web page. 4827 * @returns { string } Return the original url of the current page. 4828 * @throws { BusinessError } 17100001 - Init error. 4829 * The WebviewController must be associated with a Web component. 4830 * @syscap SystemCapability.Web.Webview.Core 4831 * @atomicservice 4832 * @since 11 4833 */ 4834 /** 4835 * Gets the original url of current Web page. 4836 * @returns { string } Return the original url of the current page. 4837 * @throws { BusinessError } 17100001 - Init error. 4838 * The WebviewController must be associated with a Web component. 4839 * @syscap SystemCapability.Web.Webview.Core 4840 * @crossplatform 4841 * @atomicservice 4842 * @since 18 4843 */ 4844 getOriginalUrl(): string; 4845 4846 /** 4847 * Gets the favicon of current Web page. 4848 * @returns { image.PixelMap } Return the favicon bitmap of the current page. 4849 * @throws { BusinessError } 17100001 - Init error. 4850 * The WebviewController must be associated with a Web component. 4851 * @syscap SystemCapability.Web.Webview.Core 4852 * @since 9 4853 */ 4854 /** 4855 * Gets the favicon of current Web page. 4856 * @returns { image.PixelMap } Return the favicon bitmap of the current page. 4857 * @throws { BusinessError } 17100001 - Init error. 4858 * The WebviewController must be associated with a Web component. 4859 * @syscap SystemCapability.Web.Webview.Core 4860 * @atomicservice 4861 * @since 11 4862 */ 4863 getFavicon(): image.PixelMap; 4864 4865 /** 4866 * Put network state for web. Which is used to set window.navigator.onLine property in 4867 * JavaScript. 4868 * @param { boolean } enable - Whether enable window.navigator.onLine. 4869 * @throws { BusinessError } 401 - Invalid input parameter. 4870 * @throws { BusinessError } 17100001 - Init error. 4871 * The WebviewController must be associated with a Web component. 4872 * @syscap SystemCapability.Web.Webview.Core 4873 * @since 9 4874 */ 4875 /** 4876 * Put network state for web. Which is used to set window.navigator.onLine property in 4877 * JavaScript. 4878 * @param { boolean } enable - Whether enable window.navigator.onLine. 4879 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 4880 * <br>2. Incorrect parameter types. 4881 * @throws { BusinessError } 17100001 - Init error. 4882 * The WebviewController must be associated with a Web component. 4883 * @syscap SystemCapability.Web.Webview.Core 4884 * @atomicservice 4885 * @since 11 4886 */ 4887 setNetworkAvailable(enable: boolean): void; 4888 4889 /** 4890 * Query if current document has image. 4891 * 4892 * @returns { Promise<boolean> } A promise resolved after query image has finished. 4893 * @throws { BusinessError } 401 - Invalid input parameter. 4894 * @throws { BusinessError } 17100001 - Init error. 4895 * The WebviewController must be associated with a Web component. 4896 * @syscap SystemCapability.Web.Webview.Core 4897 * @since 9 4898 */ 4899 /** 4900 * Query if current document has image. 4901 * 4902 * @returns { Promise<boolean> } A promise resolved after query image has finished. 4903 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 4904 * @throws { BusinessError } 17100001 - Init error. 4905 * The WebviewController must be associated with a Web component. 4906 * @syscap SystemCapability.Web.Webview.Core 4907 * @atomicservice 4908 * @since 11 4909 */ 4910 hasImage(): Promise<boolean>; 4911 4912 /** 4913 * Query if current document has image. 4914 * 4915 * @param { AsyncCallback<boolean> } callback - Called after query image has finished. 4916 * @throws { BusinessError } 401 - Invalid input parameter. 4917 * @throws { BusinessError } 17100001 - Init error. 4918 * The WebviewController must be associated with a Web component. 4919 * @syscap SystemCapability.Web.Webview.Core 4920 * @since 9 4921 */ 4922 /** 4923 * Query if current document has image. 4924 * 4925 * @param { AsyncCallback<boolean> } callback - Called after query image has finished. 4926 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 4927 * <br>2. Incorrect parameter types. 4928 * @throws { BusinessError } 17100001 - Init error. 4929 * The WebviewController must be associated with a Web component. 4930 * @syscap SystemCapability.Web.Webview.Core 4931 * @atomicservice 4932 * @since 11 4933 */ 4934 hasImage(callback: AsyncCallback<boolean>): void; 4935 4936 /** 4937 * Get back forward stack list from current webview. 4938 * @returns { BackForwardList } Back forward list for current webview. 4939 * @throws { BusinessError } 17100001 - Init error. 4940 * The WebviewController must be associated with a Web component. 4941 * @syscap SystemCapability.Web.Webview.Core 4942 * @since 9 4943 */ 4944 /** 4945 * Get back forward stack list from current webview. 4946 * @returns { BackForwardList } Back forward list for current webview. 4947 * @throws { BusinessError } 17100001 - Init error. 4948 * The WebviewController must be associated with a Web component. 4949 * @syscap SystemCapability.Web.Webview.Core 4950 * @crossplatform 4951 * @atomicservice 4952 * @since 11 4953 */ 4954 getBackForwardEntries(): BackForwardList; 4955 4956 /** 4957 * Remove resource cache in application. So this method will remove all cache for all web components in the 4958 * same application. 4959 * 4960 * @param { boolean } clearRom - Remove cache in both rom and ram if true. Otherwise only clear cache 4961 * in ram. 4962 * @throws { BusinessError } 401 - Invalid input parameter. 4963 * @throws { BusinessError } 17100001 - Init error. 4964 * The WebviewController must be associated with a Web component. 4965 * @syscap SystemCapability.Web.Webview.Core 4966 * @since 9 4967 */ 4968 /** 4969 * Remove resource cache in application. So this method will remove all cache for all web components in the 4970 * same application. 4971 * 4972 * @param { boolean } clearRom - Remove cache in both rom and ram if true. Otherwise only clear cache 4973 * in ram. 4974 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 4975 * <br>2. Incorrect parameter types. 4976 * @throws { BusinessError } 17100001 - Init error. 4977 * The WebviewController must be associated with a Web component. 4978 * @syscap SystemCapability.Web.Webview.Core 4979 * @crossplatform 4980 * @atomicservice 4981 * @since 11 4982 */ 4983 removeCache(clearRom: boolean): void; 4984 4985 /** 4986 * Remove resource cache in application. So this method will remove all cache for all web components in the 4987 * same application. 4988 * 4989 * @param { boolean } clearRom - Remove cache in both rom and ram if true. Otherwise only clear cache 4990 * in ram. 4991 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 4992 * <br>2. Incorrect parameter types. 4993 * @syscap SystemCapability.Web.Webview.Core 4994 * @since 18 4995 */ 4996 static removeAllCache(clearRom: boolean): void; 4997 4998 /** 4999 * Scroll to the position. 5000 * 5001 * @param { number } x - the x of the position. 5002 * @param { number } y - the y of the position. 5003 * @throws { BusinessError } 401 - Invalid input parameter. 5004 * @throws { BusinessError } 17100001 - Init error. 5005 * The WebviewController must be associated with a Web component. 5006 * @syscap SystemCapability.Web.Webview.Core 5007 * @since 9 5008 */ 5009 /** 5010 * Scroll to the position. 5011 * 5012 * @param { number } x - the x of the position. 5013 * @param { number } y - the y of the position. 5014 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 5015 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 5016 * @throws { BusinessError } 17100001 - Init error. 5017 * The WebviewController must be associated with a Web component. 5018 * @syscap SystemCapability.Web.Webview.Core 5019 * @crossplatform 5020 * @atomicservice 5021 * @since 11 5022 */ 5023 /** 5024 * Scroll to the position. 5025 * 5026 * @param { number } x - the x of the position. 5027 * @param { number } y - the y of the position. 5028 * @param { number } duration - the scroll animation duration. Unit: millisecond. 5029 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 5030 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 5031 * @throws { BusinessError } 17100001 - Init error. 5032 * The WebviewController must be associated with a Web component. 5033 * @syscap SystemCapability.Web.Webview.Core 5034 * @crossplatform 5035 * @atomicservice 5036 * @since 14 5037 */ 5038 scrollTo(x: number, y: number, duration?: number): void; 5039 5040 /** 5041 * Scroll by the delta position. 5042 * 5043 * @param { number } deltaX - the delta x of the position. 5044 * @param { number } deltaY - the delta y of the position. 5045 * @throws { BusinessError } 401 - Invalid input parameter. 5046 * @throws { BusinessError } 17100001 - Init error. 5047 * The WebviewController must be associated with a Web component. 5048 * @syscap SystemCapability.Web.Webview.Core 5049 * @since 9 5050 */ 5051 /** 5052 * Scroll by the delta position. 5053 * 5054 * @param { number } deltaX - the delta x of the position. 5055 * @param { number } deltaY - the delta y of the position. 5056 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 5057 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 5058 * @throws { BusinessError } 17100001 - Init error. 5059 * The WebviewController must be associated with a Web component. 5060 * @syscap SystemCapability.Web.Webview.Core 5061 * @crossplatform 5062 * @atomicservice 5063 * @since 11 5064 */ 5065 /** 5066 * Scroll by the delta position. 5067 * 5068 * @param { number } deltaX - the delta x of the position. 5069 * @param { number } deltaY - the delta y of the position. 5070 * @param { number } duration - the scroll animation duration. Unit: millisecond. 5071 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 5072 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 5073 * @throws { BusinessError } 17100001 - Init error. 5074 * The WebviewController must be associated with a Web component. 5075 * @syscap SystemCapability.Web.Webview.Core 5076 * @crossplatform 5077 * @atomicservice 5078 * @since 14 5079 */ 5080 scrollBy(deltaX: number, deltaY: number, duration?: number): void; 5081 5082 /** 5083 * Slide by the speed. 5084 * 5085 * @param { number } vx - the x speed of the speed. 5086 * @param { number } vy - the y speed of the speed. 5087 * @throws { BusinessError } 401 - Invalid input parameter. 5088 * @throws { BusinessError } 17100001 - Init error. 5089 * The WebviewController must be associated with a Web component. 5090 * @syscap SystemCapability.Web.Webview.Core 5091 * @since 9 5092 */ 5093 /** 5094 * Slide by the speed. 5095 * 5096 * @param { number } vx - the x speed of the speed. 5097 * @param { number } vy - the y speed of the speed. 5098 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 5099 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 5100 * @throws { BusinessError } 17100001 - Init error. 5101 * The WebviewController must be associated with a Web component. 5102 * @syscap SystemCapability.Web.Webview.Core 5103 * @atomicservice 5104 * @since 11 5105 */ 5106 slideScroll(vx: number, vy: number): void; 5107 5108 /** 5109 * Serialize the access stack of the web, that is, the history of access. 5110 * @returns { Uint8Array } Web access stack after serialization. 5111 * @throws { BusinessError } 17100001 - Init error. 5112 * The WebviewController must be associated with a Web component. 5113 * @syscap SystemCapability.Web.Webview.Core 5114 * @since 9 5115 */ 5116 /** 5117 * Serialize the access stack of the web, that is, the history of access. 5118 * @returns { Uint8Array } Web access stack after serialization. 5119 * @throws { BusinessError } 17100001 - Init error. 5120 * The WebviewController must be associated with a Web component. 5121 * @syscap SystemCapability.Web.Webview.Core 5122 * @atomicservice 5123 * @since 11 5124 */ 5125 serializeWebState(): Uint8Array; 5126 5127 /** 5128 * Restoring the web access stack, that is, the history of access. 5129 * @param { Uint8Array } state - Web access stack after serialization. 5130 * @throws { BusinessError } 401 - Invalid input parameter. 5131 * @throws { BusinessError } 17100001 - Init error. 5132 * The WebviewController must be associated with a Web component. 5133 * @syscap SystemCapability.Web.Webview.Core 5134 * @since 9 5135 */ 5136 /** 5137 * Restoring the web access stack, that is, the history of access. 5138 * @param { Uint8Array } state - Web access stack after serialization. 5139 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 5140 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 5141 * @throws { BusinessError } 17100001 - Init error. 5142 * The WebviewController must be associated with a Web component. 5143 * @syscap SystemCapability.Web.Webview.Core 5144 * @atomicservice 5145 * @since 11 5146 */ 5147 restoreWebState(state: Uint8Array): void; 5148 5149 /** 5150 * Set whether the Web custom scheme supports cross domain and fetch requests. 5151 * @param { Array<WebCustomScheme> } schemes - Configuration of web custom scheme. 5152 * @throws { BusinessError } 401 - Invalid input parameter. 5153 * @syscap SystemCapability.Web.Webview.Core 5154 * @since 9 5155 */ 5156 /** 5157 * Set whether the Web custom scheme supports cross domain and fetch requests. 5158 * @param { Array<WebCustomScheme> } schemes - Configuration of web custom scheme. 5159 * @throws { BusinessError } 401 - Invalid input parameter. 5160 * @syscap SystemCapability.Web.Webview.Core 5161 * @atomicservice 5162 * @since 11 5163 */ 5164 /** 5165 * Register Web custom schemes. 5166 * @param { Array<WebCustomScheme> } schemes - Configuration of web custom scheme. 5167 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 5168 * <br>2. Incorrect parameter types. 5169 * @throws { BusinessError } 17100020 - Failed to register custom schemes. 5170 * @syscap SystemCapability.Web.Webview.Core 5171 * @atomicservice 5172 * @since 12 5173 */ 5174 static customizeSchemes(schemes: Array<WebCustomScheme>): void; 5175 5176 /** 5177 * Get certificate for the current website. 5178 * @returns { Promise<Array<cert.X509Cert>> } the promise of the current website's certificate. 5179 * @throws { BusinessError } 17100001 - Init error. 5180 * The WebviewController must be associated with a web component. 5181 * @syscap SystemCapability.Web.Webview.Core 5182 * @since 10 5183 */ 5184 /** 5185 * Get certificate for the current website. 5186 * @returns { Promise<Array<cert.X509Cert>> } the promise of the current website's certificate. 5187 * @throws { BusinessError } 17100001 - Init error. 5188 * The WebviewController must be associated with a web component. 5189 * @syscap SystemCapability.Web.Webview.Core 5190 * @atomicservice 5191 * @since 11 5192 */ 5193 getCertificate(): Promise<Array<cert.X509Cert>>; 5194 5195 /** 5196 * Get certificate for the current website. 5197 * @param {AsyncCallback<Array<cert.X509Cert>>} callback - the callback of getCertificate. 5198 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 5199 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 5200 * @throws { BusinessError } 17100001 - Init error. 5201 * The WebviewController must be associated with a web component. 5202 * @syscap SystemCapability.Web.Webview.Core 5203 * @since 10 5204 */ 5205 /** 5206 * Get certificate for the current website. 5207 * @param {AsyncCallback<Array<cert.X509Cert>>} callback - the callback of getCertificate. 5208 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 5209 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 5210 * @throws { BusinessError } 17100001 - Init error. 5211 * The WebviewController must be associated with a web component. 5212 * @syscap SystemCapability.Web.Webview.Core 5213 * @atomicservice 5214 * @since 11 5215 */ 5216 getCertificate(callback: AsyncCallback<Array<cert.X509Cert>>): void; 5217 5218 /** 5219 * Set audio muted. 5220 * @param { boolean } mute - Set the audio muted or not. 5221 * @throws { BusinessError } 401 - Invalid input parameter. 5222 * @throws { BusinessError } 17100001 - Init error. 5223 * The WebviewController must be associated with a Web component. 5224 * @syscap SystemCapability.Web.Webview.Core 5225 * @since 10 5226 */ 5227 /** 5228 * Set audio muted. 5229 * @param { boolean } mute - Set the audio muted or not. 5230 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 5231 * <br>2. Incorrect parameter types. 5232 * @throws { BusinessError } 17100001 - Init error. 5233 * The WebviewController must be associated with a Web component. 5234 * @syscap SystemCapability.Web.Webview.Core 5235 * @atomicservice 5236 * @since 11 5237 */ 5238 setAudioMuted(mute: boolean): void; 5239 5240 /** 5241 * Prefetch the resources required by the page, but will not execute js or render the page. 5242 * @param { string } url - Which url to preresolve/preconnect. 5243 * @param { Array<WebHeader> } [additionalHeaders] - Additional HTTP request header of the URL. 5244 * @throws { BusinessError } 17100001 - Init error. 5245 * The WebviewController must be associated with a Web component. 5246 * @throws { BusinessError } 17100002 - Invalid url. 5247 * @syscap SystemCapability.Web.Webview.Core 5248 * @since 10 5249 */ 5250 /** 5251 * Prefetch the resources required by the page, but will not execute js or render the page. 5252 * @param { string } url - Which url to preresolve/preconnect. 5253 * @param { Array<WebHeader> } [additionalHeaders] - Additional HTTP request header of the URL. 5254 * @throws { BusinessError } 17100001 - Init error. 5255 * The WebviewController must be associated with a Web component. 5256 * @throws { BusinessError } 17100002 - Invalid url. 5257 * @syscap SystemCapability.Web.Webview.Core 5258 * @atomicservice 5259 * @since 11 5260 */ 5261 prefetchPage(url: string, additionalHeaders?: Array<WebHeader>): void; 5262 5263 /** 5264 * Preresolve or Preconnect the url. This API can be called before loading the url to make loading faster. 5265 * @param { string } url - Which url to preresolve/preconnect. 5266 * @param { boolean } preconnectable - Indicates whether to preconnect. 5267 * @param { number } numSockets - If preconnectable is true, this parameter indicates the number of sockets to be preconnected. 5268 * @throws { BusinessError } 17100002 - Invalid url. 5269 * @throws { BusinessError } 171000013 - The number of preconnect sockets is invalid. 5270 * @syscap SystemCapability.Web.Webview.Core 5271 * @since 10 5272 */ 5273 /** 5274 * Preresolve or Preconnect the url. This API can be called before loading the url to make loading faster. 5275 * @param { string } url - Which url to preresolve/preconnect. 5276 * @param { boolean } preconnectable - Indicates whether to preconnect. 5277 * @param { number } numSockets - If preconnectable is true, this parameter indicates the number of sockets to be preconnected. 5278 * @throws { BusinessError } 17100002 - Invalid url. 5279 * @throws { BusinessError } 171000013 - The number of preconnect sockets is invalid. 5280 * @syscap SystemCapability.Web.Webview.Core 5281 * @atomicservice 5282 * @since 11 5283 */ 5284 static prepareForPageLoad(url: string, preconnectable: boolean, numSockets: number): void; 5285 5286 /** 5287 * Set custom user agent. 5288 * @param { string } userAgent - User custom agent information. 5289 * @throws { BusinessError } 401 - Invalid input parameter. 5290 * @throws { BusinessError } 17100001 - Init error. 5291 * The WebviewController must be associated with a Web component. 5292 * @syscap SystemCapability.Web.Webview.Core 5293 * @since 10 5294 */ 5295 /** 5296 * Set custom user agent. 5297 * @param { string } userAgent - User custom agent information. 5298 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 5299 * <br>2. Incorrect parameter types. 5300 * @throws { BusinessError } 17100001 - Init error. 5301 * The WebviewController must be associated with a Web component. 5302 * @syscap SystemCapability.Web.Webview.Core 5303 * @crossplatform 5304 * @atomicservice 5305 * @since 11 5306 */ 5307 setCustomUserAgent(userAgent: string): void; 5308 5309 /** 5310 * Get custom user agent. 5311 * @returns { string } Get custom User agent information. 5312 * @throws { BusinessError } 17100001 - Init error. 5313 * The WebviewController must be associated with a Web component. 5314 * @syscap SystemCapability.Web.Webview.Core 5315 * @since 10 5316 */ 5317 /** 5318 * Get custom user agent. 5319 * @returns { string } Get custom User agent information. 5320 * @throws { BusinessError } 17100001 - Init error. 5321 * The WebviewController must be associated with a Web component. 5322 * @syscap SystemCapability.Web.Webview.Core 5323 * @crossplatform 5324 * @atomicservice 5325 * @since 11 5326 */ 5327 getCustomUserAgent(): string; 5328 5329 /** 5330 * Set web engine socket connection timeout. 5331 * @param { number } timeout - Socket connection timeout. 5332 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 5333 * <br>2. Incorrect parameter types. 3. Parameter verification failed. 5334 * @syscap SystemCapability.Web.Webview.Core 5335 * @atomicservice 5336 * @since 11 5337 */ 5338 static setConnectionTimeout(timeout: number): void; 5339 5340 /** 5341 * Set delegate for download. 5342 * Used to notify the progress of the download triggered from web. 5343 * @param { WebDownloadDelegate } delegate - Delegate used for download triggered from web. 5344 * @throws { BusinessError } 17100001 - Init error. 5345 * The WebviewController must be associated with a Web component. 5346 * @syscap SystemCapability.Web.Webview.Core 5347 * @atomicservice 5348 * @since 11 5349 */ 5350 /** 5351 * Set delegate for download. 5352 * Used to notify the progress of the download triggered from web. 5353 * @param { WebDownloadDelegate } delegate - Delegate used for download triggered from web. 5354 * @throws { BusinessError } 17100001 - Init error. 5355 * The WebviewController must be associated with a Web component. 5356 * @syscap SystemCapability.Web.Webview.Core 5357 * @crossplatform 5358 * @atomicservice 5359 * @since 18 5360 */ 5361 setDownloadDelegate(delegate: WebDownloadDelegate): void; 5362 5363 /** 5364 * Start a download. 5365 * @param { string } url - The download url. 5366 * @throws { BusinessError } 17100001 - Init error. 5367 * The WebviewController must be associated with a Web component. 5368 * @throws { BusinessError } 17100002 - Invalid url. 5369 * @syscap SystemCapability.Web.Webview.Core 5370 * @atomicservice 5371 * @since 11 5372 */ 5373 /** 5374 * Start a download. 5375 * @param { string } url - The download url. 5376 * @throws { BusinessError } 17100001 - Init error. 5377 * The WebviewController must be associated with a Web component. 5378 * @throws { BusinessError } 17100002 - Invalid url. 5379 * @syscap SystemCapability.Web.Webview.Core 5380 * @crossplatform 5381 * @atomicservice 5382 * @since 18 5383 */ 5384 startDownload(url: string): void; 5385 5386 /** 5387 * Loads the URL use "POST" method with post data. 5388 * 5389 * @param { string } url - Request the URL use "POST" method. 5390 * @param { ArrayBuffer } postData - This data will passed to "POST" request. 5391 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 5392 * <br>2. Incorrect parameter types. 5393 * @throws { BusinessError } 17100001 - Init error. 5394 * The WebviewController must be associated with a Web component. 5395 * @throws { BusinessError } 17100002 - Invalid url. 5396 * @syscap SystemCapability.Web.Webview.Core 5397 * @atomicservice 5398 * @since 11 5399 */ 5400 /** 5401 * Loads the URL use "POST" method with post data. 5402 * 5403 * @param { string } url - Request the URL use "POST" method. 5404 * @param { ArrayBuffer } postData - This data will passed to "POST" request. 5405 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 5406 * <br>2. Incorrect parameter types. 5407 * @throws { BusinessError } 17100001 - Init error. 5408 * The WebviewController must be associated with a Web component. 5409 * @throws { BusinessError } 17100002 - Invalid url. 5410 * @syscap SystemCapability.Web.Webview.Core 5411 * @crossplatform 5412 * @atomicservice 5413 * @since 18 5414 */ 5415 postUrl(url: string, postData: ArrayBuffer): void; 5416 5417 /** 5418 * Create the Web Print Document Adapter. 5419 * @param { string } jobName - The name of the currently printed document. 5420 * @returns { print.PrintDocumentAdapter } Return the Print Document Adapter. 5421 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 5422 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 5423 * @throws { BusinessError } 17100001 - Init error. 5424 * The WebviewController must be associated with a Web component. 5425 * @syscap SystemCapability.Web.Webview.Core 5426 * @since 11 5427 */ 5428 createWebPrintDocumentAdapter(jobName: string): print.PrintDocumentAdapter; 5429 5430 /** 5431 * Get the security level of the current page. 5432 * 5433 * @returns { SecurityLevel } the security level of current page. 5434 * @throws { BusinessError } 17100001 - Init error. 5435 * The WebviewController must be associated with a Web component. 5436 * @syscap SystemCapability.Web.Webview.Core 5437 * @atomicservice 5438 * @since 11 5439 */ 5440 getSecurityLevel(): SecurityLevel; 5441 5442 /** 5443 * Whether the incognito mode is set. 5444 * 5445 * @returns { boolean } {@code true} has been set the incognito mode; {@code false} otherwise. 5446 * @throws { BusinessError } 17100001 - Init error. 5447 * The WebviewController must be associated with a Web component. 5448 * @syscap SystemCapability.Web.Webview.Core 5449 * @atomicservice 5450 * @since 11 5451 */ 5452 isIncognitoMode(): boolean; 5453 5454 /** 5455 * Set whether scroll is allowed 5456 * 5457 * @param { boolean } enable - Set whether scrolling is allowed 5458 * @param { ScrollType } type - Enable scrolling type 5459 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 5460 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 5461 * @throws { BusinessError } 17100001 - Init error. 5462 * The WebviewController must be associated with a Web component. 5463 * @syscap SystemCapability.Web.Webview.Core 5464 * @atomicservice 5465 * @since 12 5466 */ 5467 setScrollable(enable: boolean, type?: ScrollType): void; 5468 5469 /** 5470 * Get whether scrolling is allowed. 5471 * @returns { boolean } Get scrolling is allowed information. 5472 * @throws { BusinessError } 17100001 - Init error. 5473 * The WebviewController must be associated with a Web component. 5474 * @syscap SystemCapability.Web.Webview.Core 5475 * @atomicservice 5476 * @since 12 5477 */ 5478 getScrollable(): boolean; 5479 5480 /** 5481 * Set whether print web page background. 5482 * 5483 * @param { boolean } enable - Set whether print web page background 5484 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 5485 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 5486 * @throws { BusinessError } 17100001 - Init error. 5487 * The WebviewController must be associated with a Web component. 5488 * @syscap SystemCapability.Web.Webview.Core 5489 * @atomicservice 5490 * @since 12 5491 */ 5492 setPrintBackground(enable: boolean): void; 5493 5494 /** 5495 * Get whether print web page background. 5496 * @returns { boolean } Get whether print web page background. 5497 * @throws { BusinessError } 17100001 - Init error. 5498 * The WebviewController must be associated with a Web component. 5499 * @syscap SystemCapability.Web.Webview.Core 5500 * @atomicservice 5501 * @since 12 5502 */ 5503 getPrintBackground(): boolean; 5504 5505 /** 5506 * Get the url of the last frame that calls the JavaScriptProxy. 5507 * This should be called on the UI thread. 5508 * 5509 * @returns { string } The url of the last frame that calls the JavaScriptProxy. 5510 * @throws { BusinessError } 17100001 - Init error. 5511 * The WebviewController must be associated with a Web component. 5512 * @syscap SystemCapability.Web.Webview.Core 5513 * @atomicservice 5514 * @since 12 5515 */ 5516 getLastJavascriptProxyCallingFrameUrl(): string; 5517 5518 /** 5519 * Start current camera. 5520 * 5521 * @throws { BusinessError } 17100001 - Init error. 5522 * The WebviewController must be associated with a Web component. 5523 * @syscap SystemCapability.Web.Webview.Core 5524 * @atomicservice 5525 * @since 12 5526 */ 5527 startCamera(): void; 5528 5529 /** 5530 * Stop current camera. 5531 * 5532 * @throws { BusinessError } 17100001 - Init error. 5533 * The WebviewController must be associated with a Web component. 5534 * @syscap SystemCapability.Web.Webview.Core 5535 * @atomicservice 5536 * @since 12 5537 */ 5538 stopCamera(): void; 5539 5540 /** 5541 * Close current camera. 5542 * 5543 * @throws { BusinessError } 17100001 - Init error. 5544 * The WebviewController must be associated with a Web component. 5545 * @syscap SystemCapability.Web.Webview.Core 5546 * @atomicservice 5547 * @since 12 5548 */ 5549 closeCamera(): void; 5550 5551 /** 5552 * Pauses all layout, parsing, and JavaScript timers for all WebViews. 5553 * 5554 * @throws { BusinessError } 17100001 - Init error. 5555 * The WebviewController must be associated with a Web component. 5556 * @syscap SystemCapability.Web.Webview.Core 5557 * @atomicservice 5558 * @since 12 5559 */ 5560 static pauseAllTimers(): void; 5561 5562 /** 5563 * Resumes all layout, parsing, and JavaScript timers for all WebViews. 5564 * 5565 * @throws { BusinessError } 17100001 - Init error. 5566 * The WebviewController must be associated with a Web component. 5567 * @syscap SystemCapability.Web.Webview.Core 5568 * @atomicservice 5569 * @since 12 5570 */ 5571 static resumeAllTimers(): void; 5572 5573 /** 5574 * Stop all audio and video playback on the web page. 5575 * 5576 * @throws { BusinessError } 17100001 - Init error. 5577 * The WebviewController must be associated with a Web component. 5578 * @syscap SystemCapability.Web.Webview.Core 5579 * @atomicservice 5580 * @since 12 5581 */ 5582 stopAllMedia(): void; 5583 5584 /** 5585 * Restart playback of all audio and video on the web page. 5586 * 5587 * @throws { BusinessError } 17100001 - Init error. 5588 * The WebviewController must be associated with a Web component. 5589 * @syscap SystemCapability.Web.Webview.Core 5590 * @atomicservice 5591 * @since 12 5592 */ 5593 resumeAllMedia(): void; 5594 5595 /** 5596 * Pause all audio and video playback on the web page. 5597 * 5598 * @throws { BusinessError } 17100001 - Init error. 5599 * The WebviewController must be associated with a Web component. 5600 * @syscap SystemCapability.Web.Webview.Core 5601 * @atomicservice 5602 * @since 12 5603 */ 5604 pauseAllMedia(): void; 5605 5606 /** 5607 * Close fullscreen video. 5608 * 5609 * @throws { BusinessError } 17100001 - Init error. 5610 * The WebviewController must be associated with a Web component. 5611 * @syscap SystemCapability.Web.Webview.Core 5612 * @atomicservice 5613 * @since 12 5614 */ 5615 closeAllMediaPresentations(): void; 5616 5617 /** 5618 * View the playback status of all audio and video on the web page. 5619 * 5620 * @returns { MediaPlaybackState } The playback status of all audio and video. 5621 * @throws { BusinessError } 17100001 - Init error. 5622 * The WebviewController must be associated with a Web component. 5623 * @syscap SystemCapability.Web.Webview.Core 5624 * @atomicservice 5625 * @since 12 5626 */ 5627 getMediaPlaybackState(): MediaPlaybackState; 5628 5629 /** 5630 * Set web scheme handler for specific scheme. This is only used for related web component. 5631 * 5632 * @param { string } scheme - String value for url scheme. 5633 * @param { WebSchemeHandler } handler - Web scheme handler. 5634 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types. 5635 * @throws { BusinessError } 17100001 - Init error. 5636 * The WebviewController must be associated with a Web component. 5637 * @syscap SystemCapability.Web.Webview.Core 5638 * @atomicservice 5639 * @since 12 5640 */ 5641 setWebSchemeHandler(scheme: string, handler: WebSchemeHandler): void; 5642 5643 /** 5644 * Clear all web scheme handlers for related web component. 5645 * @throws { BusinessError } 17100001 - Init error. 5646 * The WebviewController must be associated with a Web component. 5647 * @syscap SystemCapability.Web.Webview.Core 5648 * @atomicservice 5649 * @since 12 5650 */ 5651 clearWebSchemeHandler(): void; 5652 5653 /** 5654 * Set web scheme handler for specific scheme. This is used for service worker. 5655 * @param { string } scheme - String value for url scheme. 5656 * @param { WebSchemeHandler } handler - Web scheme handler. 5657 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types. 5658 * @syscap SystemCapability.Web.Webview.Core 5659 * @atomicservice 5660 * @since 12 5661 */ 5662 static setServiceWorkerWebSchemeHandler(scheme: string, handler: WebSchemeHandler): void; 5663 5664 /** 5665 * Clear all web service worker scheme handlers. 5666 * @syscap SystemCapability.Web.Webview.Core 5667 * @atomicservice 5668 * @since 12 5669 */ 5670 static clearServiceWorkerWebSchemeHandler(): void; 5671 5672 /** 5673 * Enable the ability to use Intelligent Tracking Prevention; default is disabled. 5674 * 5675 * @param { boolean } enable {@code true} enable Intelligent Tracking Prevention; {@code false} otherwise. 5676 * @throws { BusinessError } 17100001 - Init error. 5677 * The WebviewController must be associated with a Web component. 5678 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 5679 * <br>2. Incorrect parameter types. 5680 * @syscap SystemCapability.Web.Webview.Core 5681 * @atomicservice 5682 * @since 12 5683 */ 5684 /** 5685 * Enable the ability to use Intelligent Tracking Prevention; default is disabled. 5686 * 5687 * @param { boolean } enable {@code true} enable Intelligent Tracking Prevention; {@code false} otherwise. 5688 * @throws { BusinessError } 17100001 - Init error. 5689 * The WebviewController must be associated with a Web component. 5690 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 5691 * <br>2. Incorrect parameter types. 5692 * @throws { BusinessError } 801 - Capability not supported. 5693 * @syscap SystemCapability.Web.Webview.Core 5694 * @atomicservice 5695 * @since 18 5696 */ 5697 enableIntelligentTrackingPrevention(enable: boolean): void; 5698 5699 /** 5700 * Get whether Intelligent Tracking Prevention is enabled. 5701 * 5702 * @returns { boolean } True if enable the Intelligent Tracking Prevention; else false. 5703 * @throws { BusinessError } 17100001 - Init error. 5704 * The WebviewController must be associated with a Web component. 5705 * @syscap SystemCapability.Web.Webview.Core 5706 * @atomicservice 5707 * @since 12 5708 */ 5709 /** 5710 * Get whether Intelligent Tracking Prevention is enabled. 5711 * 5712 * @returns { boolean } True if enable the Intelligent Tracking Prevention; else false. 5713 * @throws { BusinessError } 17100001 - Init error. 5714 * The WebviewController must be associated with a Web component. 5715 * @throws { BusinessError } 801 - Capability not supported. 5716 * @syscap SystemCapability.Web.Webview.Core 5717 * @atomicservice 5718 * @since 18 5719 */ 5720 isIntelligentTrackingPreventionEnabled(): boolean; 5721 5722 /** 5723 * Add bypassing hosts for Intelligent Tracking Prevention. 5724 * 5725 * @param { Array<string> } hostList - Hosts that bypass the Intelligent Tracking Prevention. 5726 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 5727 * <br>2. Incorrect parameter types. 5728 * @syscap SystemCapability.Web.Webview.Core 5729 * @atomicservice 5730 * @since 12 5731 */ 5732 /** 5733 * Add bypassing hosts for Intelligent Tracking Prevention. 5734 * 5735 * @param { Array<string> } hostList - Hosts that bypass the Intelligent Tracking Prevention. 5736 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 5737 * <br>2. Incorrect parameter types. 5738 * @throws { BusinessError } 801 - Capability not supported. 5739 * @syscap SystemCapability.Web.Webview.Core 5740 * @atomicservice 5741 * @since 18 5742 */ 5743 static addIntelligentTrackingPreventionBypassingList(hostList: Array<string>): void; 5744 5745 /** 5746 * Remove bypassing hosts for Intelligent Tracking Prevention. 5747 * 5748 * @param { Array<string> } hostList - Hosts needs to remove from bypass list. 5749 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 5750 * <br>2. Incorrect parameter types. 5751 * @syscap SystemCapability.Web.Webview.Core 5752 * @atomicservice 5753 * @since 12 5754 */ 5755 /** 5756 * Remove bypassing hosts for Intelligent Tracking Prevention. 5757 * 5758 * @param { Array<string> } hostList - Hosts needs to remove from bypass list. 5759 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 5760 * <br>2. Incorrect parameter types. 5761 * @throws { BusinessError } 801 - Capability not supported. 5762 * @syscap SystemCapability.Web.Webview.Core 5763 * @atomicservice 5764 * @since 18 5765 */ 5766 static removeIntelligentTrackingPreventionBypassingList(hostList: Array<string>): void; 5767 5768 /** 5769 * Clear bypassing hosts for Intelligent Tracking Prevention. 5770 * 5771 * @syscap SystemCapability.Web.Webview.Core 5772 * @atomicservice 5773 * @since 12 5774 */ 5775 /** 5776 * Clear bypassing hosts for Intelligent Tracking Prevention. 5777 * 5778 * @throws { BusinessError } 801 - Capability not supported. 5779 * @syscap SystemCapability.Web.Webview.Core 5780 * @atomicservice 5781 * @since 18 5782 */ 5783 static clearIntelligentTrackingPreventionBypassingList(): void; 5784 5785 /** 5786 * Get the default user agent. 5787 * 5788 * @returns {string} The default user agent string. 5789 * @syscap SystemCapability.Web.Webview.Core 5790 * @since 14 5791 */ 5792 static getDefaultUserAgent(): string; 5793 5794 /** 5795 * Register a callback to intercept web pages playing media. 5796 * 5797 * @param { CreateNativeMediaPlayerCallback } callback - Called everytime when web pages try to play media. 5798 * @syscap SystemCapability.Web.Webview.Core 5799 * @atomicservice 5800 * @since 12 5801 */ 5802 onCreateNativeMediaPlayer(callback: CreateNativeMediaPlayerCallback): void; 5803 5804 /** 5805 * Set enable overall web caching 5806 * 5807 * @syscap SystemCapability.Web.Webview.Core 5808 * @atomicservice 5809 * @since 12 5810 */ 5811 static enableWholeWebPageDrawing(): void; 5812 5813 /** 5814 * Web page snapshot. 5815 * 5816 * @param { SnapshotInfo } info - The snapshot info. 5817 * @param { AsyncCallback<SnapshotResult> } callback - the callback of snapshot. 5818 * @syscap SystemCapability.Web.Webview.Core 5819 * @atomicservice 5820 * @since 12 5821 */ 5822 webPageSnapshot(info: SnapshotInfo, callback: AsyncCallback<SnapshotResult>): void; 5823 5824 /** 5825 * Prefetch the resources request and save it to the memory cache. Only support post request and its Content-Type 5826 * is application/x-www-form-urlencoded now. 5827 * You can prefetch no more than 6 resources. If you want to prefetch the seventh resource, you can clear one of 5828 * the prefetched resources that you won't use any more. Otherwise the oldest resource you prefetched will be 5829 * cleared. 5830 * @param { RequestInfo } request - The information of the request. 5831 * @param { Array<WebHeader> } [additionalHeaders] - Additional HTTP request header of the request. 5832 * @param { string } [cacheKey] - The key for memory cache. Default value is the url of the request. 5833 * Only support number and letters. 5834 * @param { number } [cacheValidTime] - The valid time of the cache for request, ranges greater than 0. 5835 * The unit is second. Default value is 300s. 5836 * The value of cacheValidTime must between 1 and 2147483647. 5837 * @throws { BusinessError } 401 - Invalid input parameter.Possible causes: 1. Mandatory parameters are left unspecified. 5838 * 2. Incorrect parameter types. 3. Parameter verification failed. 5839 * @throws { BusinessError } 17100002 - Invalid url. 5840 * @syscap SystemCapability.Web.Webview.Core 5841 * @atomicservice 5842 * @since 12 5843 */ 5844 static prefetchResource(request: RequestInfo, additionalHeaders?: Array<WebHeader>, cacheKey?: string, 5845 cacheValidTime?: number): void; 5846 5847 /** 5848 * Clear the resource that you prefetch to the memory cache using API{@link prefetchResource}. 5849 * @param { Array<string> } cacheKeyList - The keys for memory cache. 5850 * The key in cacheKeyList only support number and letters. 5851 * @syscap SystemCapability.Web.Webview.Core 5852 * @atomicservice 5853 * @since 12 5854 */ 5855 static clearPrefetchedResource(cacheKeyList: Array<string>): void; 5856 5857 /** 5858 * Set render process mode of the ArkWeb. 5859 * 5860 * @param { RenderProcessMode } mode - The render process mode for the ArkWeb. 5861 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 5862 * <br>2. Incorrect parameter types. 5863 * @syscap SystemCapability.Web.Webview.Core 5864 * @atomicservice 5865 * @since 12 5866 */ 5867 static setRenderProcessMode(mode: RenderProcessMode): void; 5868 5869 /** 5870 * Get render process mode of the ArkWeb. 5871 * 5872 * @returns { RenderProcessMode } mode - The render process mode of the ArkWeb. 5873 * @syscap SystemCapability.Web.Webview.Core 5874 * @atomicservice 5875 * @since 12 5876 */ 5877 static getRenderProcessMode(): RenderProcessMode; 5878 5879 /** 5880 * Terminate render process associated with this controller of the ArkWeb. 5881 * 5882 * @returns { boolean } true if it was possible to terminate the render process, otherwise false. 5883 * Calling this on a not yet started, or an already terminated render will have no effect. 5884 * @throws { BusinessError } 17100001 - Init error. 5885 * The WebviewController must be associated with a Web component. 5886 * @syscap SystemCapability.Web.Webview.Core 5887 * @since 12 5888 */ 5889 terminateRenderProcess(): boolean; 5890 5891 /** 5892 * Compile javascript and generate code cache. 5893 * @param { string } url - Url of the javascript. Only support HTTP/HTTPS protocol and length no longer than 2048. 5894 * @param { string | Uint8Array } script - Javascript source code. script must not be empty. 5895 * @param { CacheOptions } cacheOptions - Generate code cache option. 5896 * @returns { Promise<number> } - The promise returned by the function. 5897 * 0 means generate code cache successfully, -1 means internal error. 5898 * @throws { BusinessError } 401 - Invalid input parameter. 5899 * Possible causes: 1. Mandatory parameters are left unspecified. 5900 * 2. Incorrect parameter types. 3. Parameter verification failed. 5901 * @throws { BusinessError } 17100001 - Init error. 5902 * The WebviewController must be associated with a Web component. 5903 * @syscap SystemCapability.Web.Webview.Core 5904 * @since 12 5905 */ 5906 precompileJavaScript(url: string, script: string | Uint8Array, cacheOptions: CacheOptions): Promise<number>; 5907 5908 /** 5909 * Set IP address for host name. 5910 * 5911 * @param { string } hostName - Which host name to be resolved. 5912 * @param { string } address - Resolved IP address. 5913 * @param { number } aliveTime - The validity seconds for resolve cache. 5914 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 5915 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 5916 * @syscap SystemCapability.Web.Webview.Core 5917 * @atomicservice 5918 * @since 12 5919 */ 5920 static setHostIP(hostName: string, address: string, aliveTime: number): void; 5921 5922 /** 5923 * Clear the host name IP address. 5924 * 5925 * @param { string } hostName - Which host name to be cleared. 5926 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 5927 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 5928 * @syscap SystemCapability.Web.Webview.Core 5929 * @atomicservice 5930 * @since 12 5931 */ 5932 static clearHostIP(hostName: string): void; 5933 5934 /** 5935 * Warmup the registered service worker associated the url. 5936 * @param { string } url - The url. 5937 * @throws { BusinessError } 17100002 - Invalid url. 5938 * @syscap SystemCapability.Web.Webview.Core 5939 * @atomicservice 5940 * @since 12 5941 */ 5942 static warmupServiceWorker(url: string): void; 5943 5944 /** 5945 * Inject offline resources into cache. 5946 * 5947 * @param { Array<OfflineResourceMap> } resourceMaps - Array of offline resource info maps. 5948 * The count of array must between 1 and 30. 5949 * @throws { BusinessError } 401 - Invalid input parameter. 5950 * Possible causes: 1. Mandatory parameters are left unspecified. 5951 * 2. Incorrect parameter types. 3. Parameter verification failed. 5952 * @throws { BusinessError } 17100001 - Init error. 5953 * The WebviewController must be associated with a Web component. 5954 * @throws { BusinessError } 17100002 - Invalid url. 5955 * @syscap SystemCapability.Web.Webview.Core 5956 * @since 12 5957 */ 5958 injectOfflineResources(resourceMaps: Array<OfflineResourceMap>): void; 5959 5960 /** 5961 * Enable the ability to block Ads, disabled by default. 5962 * 5963 * @param { boolean } enable {@code true} Enable Ads block; {@code false} otherwise. 5964 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 5965 * <br>2. Parameter string is too long. 3.Parameter verification failed. 5966 * @throws { BusinessError } 17100001 - Init error. 5967 * The WebviewController must be associated with a Web component. 5968 * @syscap SystemCapability.Web.Webview.Core 5969 * @atomicservice 5970 * @since 12 5971 */ 5972 /** 5973 * Enable the ability to block Ads, disabled by default. 5974 * 5975 * @param { boolean } enable {@code true} Enable Ads block; {@code false} otherwise. 5976 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 5977 * <br>2. Parameter string is too long. 3.Parameter verification failed. 5978 * @throws { BusinessError } 17100001 - Init error. 5979 * The WebviewController must be associated with a Web component. 5980 * @throws { BusinessError } 801 - Capability not supported. 5981 * @syscap SystemCapability.Web.Webview.Core 5982 * @atomicservice 5983 * @since 18 5984 */ 5985 enableAdsBlock(enable: boolean): void; 5986 5987 /** 5988 * Get whether Ads block is enabled. 5989 * 5990 * @returns { boolean } True if the ability of AdsBlock is enabled; else false. 5991 * @syscap SystemCapability.Web.Webview.Core 5992 * @atomicservice 5993 * @since 12 5994 */ 5995 /** 5996 * Get whether Ads block is enabled. 5997 * 5998 * @returns { boolean } True if the ability of AdsBlock is enabled; else false. 5999 * @throws { BusinessError } 801 - Capability not supported. 6000 * @syscap SystemCapability.Web.Webview.Core 6001 * @atomicservice 6002 * @since 18 6003 */ 6004 isAdsBlockEnabled(): boolean; 6005 6006 /** 6007 * Get whether Ads block is enabled for current Webpage. 6008 * 6009 * @returns { boolean } True if the ability of AdsBlock is enabled for current Webpage; else false. 6010 * @syscap SystemCapability.Web.Webview.Core 6011 * @atomicservice 6012 * @since 12 6013 */ 6014 /** 6015 * Get whether Ads block is enabled for current Webpage. 6016 * 6017 * @returns { boolean } True if the ability of AdsBlock is enabled for current Webpage; else false. 6018 * @throws { BusinessError } 801 - Capability not supported. 6019 * @syscap SystemCapability.Web.Webview.Core 6020 * @atomicservice 6021 * @since 18 6022 */ 6023 isAdsBlockEnabledForCurPage(): boolean; 6024 6025 /** 6026 * Get the ID of the surface created by ArkWeb. This ID can be used for web page screenshots. 6027 * 6028 * @returns { string } The ID of the surface created by ArkWeb. 6029 * @syscap SystemCapability.Web.Webview.Core 6030 * @atomicservice 6031 * @since 12 6032 */ 6033 getSurfaceId(): string; 6034 6035 /** 6036 * Set the URL trust list for the ArkWeb. 6037 * When the URL trust list has been set, only the URLs in the list can be accessed. 6038 * 6039 * @param { string } urlTrustList - the URL trust list in JSON format. 6040 * An empty string means that all URLs are allowed to access. 6041 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 6042 * <br>2. Parameter string is too long. 3.Parameter verification failed. 6043 * @throws { BusinessError } 17100001 - Init error. 6044 * The WebviewController must be associated with a Web component. 6045 * @syscap SystemCapability.Web.Webview.Core 6046 * @atomicservice 6047 * @since 12 6048 */ 6049 setUrlTrustList(urlTrustList: string): void; 6050 6051 /** 6052 * Set a path list, allowing cross-origin request access any origin when the file scheme URLs access resources in this 6053 * path list. Also, When the path list is set, the file scheme URLs only allow access to resources within the path list. 6054 * Path in the path list must meet one of the following path formats(sub path and module name must be provided): 6055 * 6056 * 1. App bundle resource directory, like "/data/storage/el1/bundle/entry/resource/resfile". 6057 * You can get resource directory using Context.resourceDir in AbilityKit. 6058 * 2. A sub path of app files directory, like "/data/storage/el2/base/files/example/" 6059 * or "/data/storage/el2/base/haps/entry/files/example". 6060 * You can get app files directory using Context.filesDir in AbilityKit. 6061 * 6062 * @param { Array<string> } pathList - The path list allow universal access. 6063 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 6064 * <br>2. Parameter string is too long. 3.Parameter verification failed. 6065 * @throws { BusinessError } 17100001 - Init error. 6066 * The WebviewController must be associated with a Web component. 6067 * @syscap SystemCapability.Web.Webview.Core 6068 * @since 12 6069 */ 6070 setPathAllowingUniversalAccess(pathList: Array<string>): void; 6071 6072 /** 6073 * Trim memory by different memory pressure level. 6074 * 6075 * @param { PressureLevel } level - The memory pressure level for the ArkWeb. 6076 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 6077 * <br>2. Parameter string is too long. 3.Parameter verification failed. 6078 * @syscap SystemCapability.Web.Webview.Core 6079 * @atomicservice 6080 * @since 14 6081 */ 6082 static trimMemoryByPressureLevel(level: PressureLevel): void; 6083 6084 /** 6085 * Enable the BackForwardCache and indicate features that are allowed to enter BackForwardCache. 6086 * Default is disabled. 6087 * 6088 * @param { BackForwardCacheSupportedFeatures } features - The features that supports BackForwardCache. 6089 * @syscap SystemCapability.Web.Webview.Core 6090 * @since 12 6091 */ 6092 static enableBackForwardCache(features: BackForwardCacheSupportedFeatures): void; 6093 6094 /** 6095 * Configure the BackForwardCache. 6096 * 6097 * @param { BackForwardCacheOptions } options - The configuration of BackForwardCache. 6098 * @throws { BusinessError } 17100001 - Init error. 6099 * The WebviewController must be associated with a Web component. 6100 * @syscap SystemCapability.Web.Webview.Core 6101 * @since 12 6102 */ 6103 setBackForwardCacheOptions(options: BackForwardCacheOptions): void; 6104 6105 /** 6106 * Get the scroll offset of the webpage in view port, the coordinates of the top left corner of the view port are X: 0, Y: 0. 6107 * And the unit is virtual pixel. 6108 * 6109 * @returns { ScrollOffset } scroll offset 6110 * @syscap SystemCapability.Web.Webview.Core 6111 * @atomicservice 6112 * @since 13 6113 */ 6114 getScrollOffset(): ScrollOffset; 6115 6116 /** 6117 * Scrolls by the specified delta position and returns a result indicating whether the scrolling operation was successful or not. 6118 * 6119 * @param { number } deltaX - the delta x of the position. 6120 * @param { number } deltaY - the delta y of the position. 6121 * @returns { boolean } true if the scroll operation is successful, otherwise false. 6122 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 6123 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 6124 * @throws { BusinessError } 17100001 - Init error. 6125 * The WebviewController must be associated with a Web component. 6126 * @syscap SystemCapability.Web.Webview.Core 6127 * @since 12 6128 */ 6129 scrollByWithResult(deltaX: number, deltaY: number): boolean; 6130 6131 /** 6132 * Gets the last hit test value of HitTest. 6133 * @returns { HitTestValue } Return the element information of the clicked area. 6134 * @throws { BusinessError } 17100001 - Init error. 6135 * The WebviewController must be associated with a Web component. 6136 * @syscap SystemCapability.Web.Webview.Core 6137 * @since 18 6138 */ 6139 getLastHitTest(): HitTestValue; 6140 } 6141 6142 /** 6143 * Defines the state for download. 6144 * @enum {number} 6145 * @syscap SystemCapability.Web.Webview.Core 6146 * @atomicservice 6147 * @since 11 6148 */ 6149 /** 6150 * Defines the state for download. 6151 * @enum {number} 6152 * @syscap SystemCapability.Web.Webview.Core 6153 * @crossplatform 6154 * @atomicservice 6155 * @since 18 6156 */ 6157 enum WebDownloadState { 6158 /** 6159 * The web download is in progress. 6160 * @syscap SystemCapability.Web.Webview.Core 6161 * @atomicservice 6162 * @since 11 6163 */ 6164 /** 6165 * The web download is in progress. 6166 * @syscap SystemCapability.Web.Webview.Core 6167 * @crossplatform 6168 * @atomicservice 6169 * @since 18 6170 */ 6171 IN_PROGRESS = 0, 6172 6173 /** 6174 * The web download has been completed. 6175 * @syscap SystemCapability.Web.Webview.Core 6176 * @atomicservice 6177 * @since 11 6178 */ 6179 /** 6180 * The web download has been completed. 6181 * @syscap SystemCapability.Web.Webview.Core 6182 * @crossplatform 6183 * @atomicservice 6184 * @since 18 6185 */ 6186 COMPLETED, 6187 6188 /** 6189 * The web download was canceled. 6190 * @syscap SystemCapability.Web.Webview.Core 6191 * @atomicservice 6192 * @since 11 6193 */ 6194 /** 6195 * The web download was canceled. 6196 * @syscap SystemCapability.Web.Webview.Core 6197 * @crossplatform 6198 * @atomicservice 6199 * @since 18 6200 */ 6201 CANCELED, 6202 6203 /** 6204 * The web download was interrupted. 6205 * @syscap SystemCapability.Web.Webview.Core 6206 * @atomicservice 6207 * @since 11 6208 */ 6209 /** 6210 * The web download was interrupted. 6211 * @syscap SystemCapability.Web.Webview.Core 6212 * @crossplatform 6213 * @atomicservice 6214 * @since 18 6215 */ 6216 INTERRUPTED, 6217 6218 /** 6219 * The web download is pending. 6220 * @syscap SystemCapability.Web.Webview.Core 6221 * @atomicservice 6222 * @since 11 6223 */ 6224 /** 6225 * The web download is pending. 6226 * @syscap SystemCapability.Web.Webview.Core 6227 * @crossplatform 6228 * @atomicservice 6229 * @since 18 6230 */ 6231 PENDING, 6232 6233 /** 6234 * The web download has been paused. 6235 * @syscap SystemCapability.Web.Webview.Core 6236 * @atomicservice 6237 * @since 11 6238 */ 6239 /** 6240 * The web download has been paused. 6241 * @syscap SystemCapability.Web.Webview.Core 6242 * @crossplatform 6243 * @atomicservice 6244 * @since 18 6245 */ 6246 PAUSED, 6247 6248 /** 6249 * Unknown state. 6250 * @syscap SystemCapability.Web.Webview.Core 6251 * @atomicservice 6252 * @since 11 6253 */ 6254 /** 6255 * Unknown state. 6256 * @syscap SystemCapability.Web.Webview.Core 6257 * @crossplatform 6258 * @atomicservice 6259 * @since 18 6260 */ 6261 UNKNOWN, 6262 } 6263 6264 /** 6265 * Defines the error code for download. 6266 * @enum {number} 6267 * @syscap SystemCapability.Web.Webview.Core 6268 * @atomicservice 6269 * @since 11 6270 */ 6271 /** 6272 * Defines the error code for download. 6273 * @enum {number} 6274 * @syscap SystemCapability.Web.Webview.Core 6275 * @crossplatform 6276 * @atomicservice 6277 * @since 18 6278 */ 6279 enum WebDownloadErrorCode { 6280 /** 6281 * Unknown error. 6282 * @syscap SystemCapability.Web.Webview.Core 6283 * @atomicservice 6284 * @since 11 6285 */ 6286 ERROR_UNKNOWN = 0, 6287 6288 /** 6289 * Generic file operation failure. 6290 * @syscap SystemCapability.Web.Webview.Core 6291 * @atomicservice 6292 * @since 11 6293 */ 6294 FILE_FAILED = 1, 6295 6296 /** 6297 * The file cannot be accessed due to certain restrictions. 6298 * @syscap SystemCapability.Web.Webview.Core 6299 * @atomicservice 6300 * @since 11 6301 */ 6302 FILE_ACCESS_DENIED = 2, 6303 6304 /** 6305 * There is not enough disk space. 6306 * @syscap SystemCapability.Web.Webview.Core 6307 * @atomicservice 6308 * @since 11 6309 */ 6310 FILE_NO_SPACE = 3, 6311 6312 /** 6313 * The file name is too long. 6314 * @syscap SystemCapability.Web.Webview.Core 6315 * @atomicservice 6316 * @since 11 6317 */ 6318 FILE_NAME_TOO_LONG = 5, 6319 6320 /** 6321 * The file is too large. 6322 * @syscap SystemCapability.Web.Webview.Core 6323 * @atomicservice 6324 * @since 11 6325 */ 6326 FILE_TOO_LARGE = 6, 6327 6328 /** 6329 * Some temporary problems occurred, such as not enough memory, files in use, and too many files open at the same time. 6330 * @syscap SystemCapability.Web.Webview.Core 6331 * @atomicservice 6332 * @since 11 6333 */ 6334 FILE_TRANSIENT_ERROR = 10, 6335 6336 /** 6337 * The file is blocked from accessing because of some local policy. 6338 * @syscap SystemCapability.Web.Webview.Core 6339 * @atomicservice 6340 * @since 11 6341 */ 6342 FILE_BLOCKED = 11, 6343 6344 /** 6345 * When trying to resume the download, Found that the file is not long enough, maybe the file no longer exists. 6346 * @syscap SystemCapability.Web.Webview.Core 6347 * @atomicservice 6348 * @since 11 6349 */ 6350 FILE_TOO_SHORT = 13, 6351 6352 /** 6353 * Hash mismatch. 6354 * @syscap SystemCapability.Web.Webview.Core 6355 * @atomicservice 6356 * @since 11 6357 */ 6358 FILE_HASH_MISMATCH = 14, 6359 6360 /** 6361 * The file already exists. 6362 * @syscap SystemCapability.Web.Webview.Core 6363 * @atomicservice 6364 * @since 11 6365 */ 6366 FILE_SAME_AS_SOURCE = 15, 6367 6368 /** 6369 * Generic network error. 6370 * @syscap SystemCapability.Web.Webview.Core 6371 * @atomicservice 6372 * @since 11 6373 */ 6374 NETWORK_FAILED = 20, 6375 6376 /** 6377 * The network operation timed out. 6378 * @syscap SystemCapability.Web.Webview.Core 6379 * @atomicservice 6380 * @since 11 6381 */ 6382 NETWORK_TIMEOUT = 21, 6383 6384 /** 6385 * The network was disconnected. 6386 * @syscap SystemCapability.Web.Webview.Core 6387 * @atomicservice 6388 * @since 11 6389 */ 6390 NETWORK_DISCONNECTED = 22, 6391 6392 /** 6393 * Server down. 6394 * @syscap SystemCapability.Web.Webview.Core 6395 * @atomicservice 6396 * @since 11 6397 */ 6398 NETWORK_SERVER_DOWN = 23, 6399 6400 /** 6401 * Invalid network requests,may redirect to unsupported scheme or an invalid URL. 6402 * @syscap SystemCapability.Web.Webview.Core 6403 * @atomicservice 6404 * @since 11 6405 */ 6406 NETWORK_INVALID_REQUEST = 24, 6407 6408 /** 6409 * The server returned a generic error. 6410 * @syscap SystemCapability.Web.Webview.Core 6411 * @atomicservice 6412 * @since 11 6413 */ 6414 SERVER_FAILED = 30, 6415 6416 /** 6417 * The server does not support range requests. 6418 * @syscap SystemCapability.Web.Webview.Core 6419 * @atomicservice 6420 * @since 11 6421 */ 6422 SERVER_NO_RANGE = 31, 6423 6424 /** 6425 * The server does not have the requested data. 6426 * @syscap SystemCapability.Web.Webview.Core 6427 * @atomicservice 6428 * @since 11 6429 */ 6430 SERVER_BAD_CONTENT = 33, 6431 6432 /** 6433 * The server does not allow the file to be downloaded. 6434 * @syscap SystemCapability.Web.Webview.Core 6435 * @atomicservice 6436 * @since 11 6437 */ 6438 SERVER_UNAUTHORIZED = 34, 6439 6440 /** 6441 * Server certificate error. 6442 * @syscap SystemCapability.Web.Webview.Core 6443 * @atomicservice 6444 * @since 11 6445 */ 6446 SERVER_CERT_PROBLEM = 35, 6447 6448 /** 6449 * Server access forbidden. 6450 * @syscap SystemCapability.Web.Webview.Core 6451 * @atomicservice 6452 * @since 11 6453 */ 6454 SERVER_FORBIDDEN = 36, 6455 6456 /** 6457 * Server unreachable. 6458 * @syscap SystemCapability.Web.Webview.Core 6459 * @atomicservice 6460 * @since 11 6461 */ 6462 SERVER_UNREACHABLE = 37, 6463 6464 /** 6465 * The received data does not match content-length. 6466 * @syscap SystemCapability.Web.Webview.Core 6467 * @atomicservice 6468 * @since 11 6469 */ 6470 SERVER_CONTENT_LENGTH_MISMATCH = 38, 6471 6472 /** 6473 * An unexpected cross-origin redirect happened. 6474 * @syscap SystemCapability.Web.Webview.Core 6475 * @atomicservice 6476 * @since 11 6477 */ 6478 SERVER_CROSS_ORIGIN_REDIRECT = 39, 6479 6480 /** 6481 * User cancel. 6482 * @syscap SystemCapability.Web.Webview.Core 6483 * @atomicservice 6484 * @since 11 6485 */ 6486 /** 6487 * User cancel. 6488 * @syscap SystemCapability.Web.Webview.Core 6489 * @crossplatform 6490 * @atomicservice 6491 * @since 18 6492 */ 6493 USER_CANCELED = 40, 6494 6495 /** 6496 * User shut down the application. 6497 * @syscap SystemCapability.Web.Webview.Core 6498 * @atomicservice 6499 * @since 11 6500 */ 6501 USER_SHUTDOWN = 41, 6502 6503 /** 6504 * Application crash. 6505 * @syscap SystemCapability.Web.Webview.Core 6506 * @atomicservice 6507 * @since 11 6508 */ 6509 CRASH = 50, 6510 } 6511 6512 /** 6513 * Represents a download task, You can use this object to operate the corresponding download task. 6514 * @syscap SystemCapability.Web.Webview.Core 6515 * @atomicservice 6516 * @since 11 6517 */ 6518 /** 6519 * Represents a download task, You can use this object to operate the corresponding download task. 6520 * @syscap SystemCapability.Web.Webview.Core 6521 * @crossplatform 6522 * @atomicservice 6523 * @since 18 6524 */ 6525 class WebDownloadItem { 6526 /** 6527 * Get guid. 6528 * @returns { string } - Returns the download's guid. 6529 * @syscap SystemCapability.Web.Webview.Core 6530 * @atomicservice 6531 * @since 11 6532 */ 6533 /** 6534 * Get guid. 6535 * @returns { string } - Returns the download's guid. 6536 * @syscap SystemCapability.Web.Webview.Core 6537 * @crossplatform 6538 * @atomicservice 6539 * @since 18 6540 */ 6541 getGuid(): string; 6542 6543 /** 6544 * Get current speed, in bytes per second. 6545 * @returns { number } - Returns the current download speed. 6546 * @syscap SystemCapability.Web.Webview.Core 6547 * @atomicservice 6548 * @since 11 6549 */ 6550 /** 6551 * Get current speed, in bytes per second. 6552 * @returns { number } - Returns the current download speed. 6553 * @syscap SystemCapability.Web.Webview.Core 6554 * @crossplatform 6555 * @atomicservice 6556 * @since 18 6557 */ 6558 getCurrentSpeed(): number; 6559 6560 /** 6561 * Get percent complete. 6562 * @returns { number } - Returns -1 if progress is unknown. 100 if the download is already complete. 6563 * @syscap SystemCapability.Web.Webview.Core 6564 * @atomicservice 6565 * @since 11 6566 */ 6567 /** 6568 * Get percent complete. 6569 * @returns { number } - Returns -1 if progress is unknown. 100 if the download is already complete. 6570 * @syscap SystemCapability.Web.Webview.Core 6571 * @crossplatform 6572 * @atomicservice 6573 * @since 18 6574 */ 6575 getPercentComplete(): number; 6576 6577 /** 6578 * Get total bytes. 6579 * @returns { number } - Returns the total bytes received, -1 if the total size is unknown. 6580 * @syscap SystemCapability.Web.Webview.Core 6581 * @atomicservice 6582 * @since 11 6583 */ 6584 /** 6585 * Get total bytes. 6586 * @returns { number } - Returns the total bytes received, -1 if the total size is unknown. 6587 * @syscap SystemCapability.Web.Webview.Core 6588 * @crossplatform 6589 * @atomicservice 6590 * @since 18 6591 */ 6592 getTotalBytes(): number; 6593 6594 /** 6595 * Get state of the web download. 6596 * @returns { WebDownloadState } - Returns the current download state. 6597 * @syscap SystemCapability.Web.Webview.Core 6598 * @atomicservice 6599 * @since 11 6600 */ 6601 /** 6602 * Get state of the web download. 6603 * @returns { WebDownloadState } - Returns the current download state. 6604 * @syscap SystemCapability.Web.Webview.Core 6605 * @crossplatform 6606 * @atomicservice 6607 * @since 18 6608 */ 6609 getState(): WebDownloadState; 6610 6611 /** 6612 * Get last error code of the web download. 6613 * @returns { WebDownloadErrorCode } - Returns the last error code. 6614 * @syscap SystemCapability.Web.Webview.Core 6615 * @atomicservice 6616 * @since 11 6617 */ 6618 /** 6619 * Get last error code of the web download. 6620 * @returns { WebDownloadErrorCode } - Returns the last error code. 6621 * @syscap SystemCapability.Web.Webview.Core 6622 * @crossplatform 6623 * @atomicservice 6624 * @since 18 6625 */ 6626 getLastErrorCode(): WebDownloadErrorCode; 6627 6628 /** 6629 * Get http method of the web download request. 6630 * @returns { string } - Returns the http request method. 6631 * @syscap SystemCapability.Web.Webview.Core 6632 * @atomicservice 6633 * @since 11 6634 */ 6635 /** 6636 * Get http method of the web download request. 6637 * @returns { string } - Returns the http request method. 6638 * @syscap SystemCapability.Web.Webview.Core 6639 * @crossplatform 6640 * @atomicservice 6641 * @since 18 6642 */ 6643 getMethod(): string; 6644 6645 /** 6646 * Get mime type of the web download. 6647 * @returns { string } - Returns the mimetype. 6648 * @syscap SystemCapability.Web.Webview.Core 6649 * @atomicservice 6650 * @since 11 6651 */ 6652 /** 6653 * Get mime type of the web download. 6654 * @returns { string } - Returns the mimetype. 6655 * @syscap SystemCapability.Web.Webview.Core 6656 * @crossplatform 6657 * @atomicservice 6658 * @since 18 6659 */ 6660 getMimeType(): string; 6661 6662 /** 6663 * Get url of the web download request. 6664 * @returns { string } - Returns the url. 6665 * @syscap SystemCapability.Web.Webview.Core 6666 * @atomicservice 6667 * @since 11 6668 */ 6669 /** 6670 * Get url of the web download request. 6671 * @returns { string } - Returns the url. 6672 * @syscap SystemCapability.Web.Webview.Core 6673 * @crossplatform 6674 * @atomicservice 6675 * @since 18 6676 */ 6677 getUrl(): string; 6678 6679 /** 6680 * Get suggested file name of the web download request. 6681 * @returns { string } - Returns the suggested file name. 6682 * @syscap SystemCapability.Web.Webview.Core 6683 * @atomicservice 6684 * @since 11 6685 */ 6686 /** 6687 * Get suggested file name of the web download request. 6688 * @returns { string } - Returns the suggested file name. 6689 * @syscap SystemCapability.Web.Webview.Core 6690 * @crossplatform 6691 * @atomicservice 6692 * @since 18 6693 */ 6694 getSuggestedFileName(): string; 6695 6696 /** 6697 * Start the web download. 6698 * Used in onBeforeDownload, If you want to start the current download, call this function. 6699 * @param { string } downloadPath - The content will be downloaded to this file. 6700 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types. 6701 * <br>2. Parameter verification failed. 6702 * @syscap SystemCapability.Web.Webview.Core 6703 * @atomicservice 6704 * @since 11 6705 */ 6706 /** 6707 * Start the web download. 6708 * Used in onBeforeDownload, If you want to start the current download, call this function. 6709 * @param { string } downloadPath - The content will be downloaded to this file. 6710 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types. 6711 * <br>2. Parameter verification failed. 6712 * @syscap SystemCapability.Web.Webview.Core 6713 * @crossplatform 6714 * @atomicservice 6715 * @since 18 6716 */ 6717 start(downloadPath: string): void; 6718 6719 /** 6720 * Cancel the web download. 6721 * @syscap SystemCapability.Web.Webview.Core 6722 * @atomicservice 6723 * @since 11 6724 */ 6725 /** 6726 * Cancel the web download. 6727 * @syscap SystemCapability.Web.Webview.Core 6728 * @crossplatform 6729 * @atomicservice 6730 * @since 18 6731 */ 6732 cancel(): void; 6733 6734 /** 6735 * Pause the web download. 6736 * @throws { BusinessError } 17100019 - The download task is not started yet. 6737 * @syscap SystemCapability.Web.Webview.Core 6738 * @atomicservice 6739 * @since 11 6740 */ 6741 /** 6742 * Pause the web download. 6743 * @throws { BusinessError } 17100019 - The download task is not started yet. 6744 * @syscap SystemCapability.Web.Webview.Core 6745 * @crossplatform 6746 * @atomicservice 6747 * @since 18 6748 */ 6749 pause(): void; 6750 6751 /** 6752 * Resume the web download. 6753 * Use WebDownloadManager.resumeDownload to resume deserialized downloads. 6754 * WebDownloadItem.resume is only used to resume the currently paused download. 6755 * @throws { BusinessError } 17100016 - The download task is not paused. 6756 * @syscap SystemCapability.Web.Webview.Core 6757 * @atomicservice 6758 * @since 11 6759 */ 6760 /** 6761 * Resume the web download. 6762 * Use WebDownloadManager.resumeDownload to resume deserialized downloads. 6763 * WebDownloadItem.resume is only used to resume the currently paused download. 6764 * @throws { BusinessError } 17100016 - The download task is not paused. 6765 * @syscap SystemCapability.Web.Webview.Core 6766 * @crossplatform 6767 * @atomicservice 6768 * @since 18 6769 */ 6770 resume(): void; 6771 6772 /** 6773 * Get received bytes. 6774 * @returns { number } - Returns the received bytes. 6775 * @syscap SystemCapability.Web.Webview.Core 6776 * @atomicservice 6777 * @since 11 6778 */ 6779 /** 6780 * Get received bytes. 6781 * @returns { number } - Returns the received bytes. 6782 * @syscap SystemCapability.Web.Webview.Core 6783 * @crossplatform 6784 * @atomicservice 6785 * @since 18 6786 */ 6787 getReceivedBytes(): number; 6788 6789 /** 6790 * Get full path of the web download. 6791 * @returns { string } - Returns the full path of the download. 6792 * @syscap SystemCapability.Web.Webview.Core 6793 * @atomicservice 6794 * @since 11 6795 */ 6796 /** 6797 * Get full path of the web download. 6798 * @returns { string } - Returns the full path of the download. 6799 * @syscap SystemCapability.Web.Webview.Core 6800 * @crossplatform 6801 * @atomicservice 6802 * @since 18 6803 */ 6804 getFullPath(): string; 6805 6806 /** 6807 * Serialize web download to typed array. 6808 * @returns { Uint8Array } - Returns the serialized data. 6809 * @syscap SystemCapability.Web.Webview.Core 6810 * @atomicservice 6811 * @since 11 6812 */ 6813 serialize(): Uint8Array; 6814 6815 /** 6816 * Deserialize web download from typed array. 6817 * @param { Uint8Array } serializedData - The serialized data. 6818 * @returns { WebDownloadItem } - Deserialize the serialized data into a WebDownloadItem. 6819 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types. 6820 * <br>2. Parameter verification failed. 6821 * @syscap SystemCapability.Web.Webview.Core 6822 * @atomicservice 6823 * @since 11 6824 */ 6825 static deserialize(serializedData: Uint8Array): WebDownloadItem; 6826 } 6827 6828 /** 6829 * The download state is notified through this delegate. 6830 * @syscap SystemCapability.Web.Webview.Core 6831 * @atomicservice 6832 * @since 11 6833 */ 6834 /** 6835 * The download state is notified through this delegate. 6836 * @syscap SystemCapability.Web.Webview.Core 6837 * @crossplatform 6838 * @atomicservice 6839 * @since 18 6840 */ 6841 class WebDownloadDelegate { 6842 /** 6843 * Callback will be triggered before web download start. 6844 * @param { Callback<WebDownloadItem> } callback - The callback of download will be start. 6845 * @syscap SystemCapability.Web.Webview.Core 6846 * @atomicservice 6847 * @since 11 6848 */ 6849 /** 6850 * Callback will be triggered before web download start. 6851 * @param { Callback<WebDownloadItem> } callback - The callback of download will be start. 6852 * @syscap SystemCapability.Web.Webview.Core 6853 * @crossplatform 6854 * @atomicservice 6855 * @since 18 6856 */ 6857 onBeforeDownload(callback: Callback<WebDownloadItem>): void; 6858 6859 /** 6860 * Callback will be triggered when web download is processing. 6861 * @param { Callback<WebDownloadItem> } callback - The callback of download did update. 6862 * @syscap SystemCapability.Web.Webview.Core 6863 * @atomicservice 6864 * @since 11 6865 */ 6866 /** 6867 * Callback will be triggered when web download is processing. 6868 * @param { Callback<WebDownloadItem> } callback - The callback of download did update. 6869 * @syscap SystemCapability.Web.Webview.Core 6870 * @crossplatform 6871 * @atomicservice 6872 * @since 18 6873 */ 6874 onDownloadUpdated(callback: Callback<WebDownloadItem>): void; 6875 6876 /** 6877 * Callback will be triggered when web download is completed. 6878 * @param { Callback<WebDownloadItem> } callback - The callback of download did finish. 6879 * @syscap SystemCapability.Web.Webview.Core 6880 * @atomicservice 6881 * @since 11 6882 */ 6883 /** 6884 * Callback will be triggered when web download is completed. 6885 * @param { Callback<WebDownloadItem> } callback - The callback of download did finish. 6886 * @syscap SystemCapability.Web.Webview.Core 6887 * @crossplatform 6888 * @atomicservice 6889 * @since 18 6890 */ 6891 onDownloadFinish(callback: Callback<WebDownloadItem>): void; 6892 6893 /** 6894 * Callback will be triggered when web download is interrupted or canceled. 6895 * @param { Callback<WebDownloadItem> } callback - The callback of download did fail. 6896 * @syscap SystemCapability.Web.Webview.Core 6897 * @atomicservice 6898 * @since 11 6899 */ 6900 /** 6901 * Callback will be triggered when web download is interrupted or canceled. 6902 * @param { Callback<WebDownloadItem> } callback - The callback of download did fail. 6903 * @syscap SystemCapability.Web.Webview.Core 6904 * @crossplatform 6905 * @atomicservice 6906 * @since 18 6907 */ 6908 onDownloadFailed(callback: Callback<WebDownloadItem>): void; 6909 } 6910 6911 /** 6912 * You can trigger download manually through this interface, or resume failed or canceled downloads. 6913 * @syscap SystemCapability.Web.Webview.Core 6914 * @atomicservice 6915 * @since 11 6916 */ 6917 /** 6918 * You can trigger download manually through this interface, or resume failed or canceled downloads. 6919 * @syscap SystemCapability.Web.Webview.Core 6920 * @crossplatform 6921 * @atomicservice 6922 * @since 18 6923 */ 6924 class WebDownloadManager { 6925 /** 6926 * Set a delegate used to receive the progress of the download triggered from WebDownloadManager. 6927 * @param { WebDownloadDelegate } delegate - Delegate used for download triggered from WebDownloadManager. 6928 * @syscap SystemCapability.Web.Webview.Core 6929 * @atomicservice 6930 * @since 11 6931 */ 6932 /** 6933 * Set a delegate used to receive the progress of the download triggered from WebDownloadManager. 6934 * @param { WebDownloadDelegate } delegate - Delegate used for download triggered from WebDownloadManager. 6935 * @syscap SystemCapability.Web.Webview.Core 6936 * @crossplatform 6937 * @atomicservice 6938 * @since 18 6939 */ 6940 static setDownloadDelegate(delegate: WebDownloadDelegate): void; 6941 6942 /** 6943 * Resume the canceled or failed download. 6944 * @param { WebDownloadItem } webDownloadItem - Download that need to be resume. 6945 * @throws { BusinessError } 17100018 - No WebDownloadDelegate has been set yet. 6946 * @syscap SystemCapability.Web.Webview.Core 6947 * @atomicservice 6948 * @since 11 6949 */ 6950 static resumeDownload(webDownloadItem: WebDownloadItem): void; 6951 } 6952 6953 /** 6954 * The http body stream of the request. 6955 * 6956 * @syscap SystemCapability.Web.Webview.Core 6957 * @atomicservice 6958 * @since 12 6959 */ 6960 class WebHttpBodyStream { 6961 /** 6962 * Initialize data stream. 6963 * 6964 * @returns { Promise<void> } The promise of data stream is initialized. 6965 * @throws { BusinessError } 17100022 - Failed to initialize the HTTP body stream. 6966 * @syscap SystemCapability.Web.Webview.Core 6967 * @atomicservice 6968 * @since 12 6969 */ 6970 initialize(): Promise<void>; 6971 /** 6972 * Read the data stream to the buffer. 6973 * 6974 * @param { number } size - Read size. 6975 * @returns { Promise<ArrayBuffer> } Read array buffer of result. 6976 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 6977 * <br>2. Incorrect parameter types. 3.Parameter verification failed. 6978 * @syscap SystemCapability.Web.Webview.Core 6979 * @atomicservice 6980 * @since 12 6981 */ 6982 read(size: number): Promise<ArrayBuffer>; 6983 /** 6984 * Get the total size of the data stream. When data is chunked, always return zero. 6985 * 6986 * @returns { number } Return size of data stream size. 6987 * @syscap SystemCapability.Web.Webview.Core 6988 * @atomicservice 6989 * @since 12 6990 */ 6991 getSize(): number; 6992 /** 6993 * Get the current position of the data stream. 6994 * 6995 * @returns { number } Return position in post data stream. 6996 * @syscap SystemCapability.Web.Webview.Core 6997 * @atomicservice 6998 * @since 12 6999 */ 7000 getPosition(): number; 7001 /** 7002 * Whether data stream is chunked. 7003 * 7004 * @returns { boolean } Whether data stream is chunked. 7005 * @syscap SystemCapability.Web.Webview.Core 7006 * @atomicservice 7007 * @since 12 7008 */ 7009 isChunked(): boolean; 7010 /** 7011 * Whether all data stream has been consumed. For chunked uploads, 7012 * returns false until the first read attempt. 7013 * 7014 * @returns { boolean } Whether data stream has been consumed. 7015 * @syscap SystemCapability.Web.Webview.Core 7016 * @atomicservice 7017 * @since 12 7018 */ 7019 isEof(): boolean; 7020 /** 7021 * Returns true if the upload data in the stream is entirely in memory, and all read requests will succeed 7022 * synchronously. Expected to return false for chunked requests. 7023 * 7024 * @returns { boolean } Whether the data stream is in memory. 7025 * @syscap SystemCapability.Web.Webview.Core 7026 * @atomicservice 7027 * @since 12 7028 */ 7029 isInMemory(): boolean; 7030 } 7031 7032 /** 7033 * Defines the resource type of request. 7034 * @enum {number} 7035 * @syscap SystemCapability.Web.Webview.Core 7036 * @since 12 7037 */ 7038 enum WebResourceType { 7039 /** 7040 * Top level page. 7041 * 7042 * @syscap SystemCapability.Web.Webview.Core 7043 * @since 12 7044 */ 7045 MAIN_FRAME = 0, 7046 7047 /** 7048 * Frame or Iframe. 7049 * 7050 * @syscap SystemCapability.Web.Webview.Core 7051 * @since 12 7052 */ 7053 SUB_FRAME = 1, 7054 7055 /** 7056 * CSS stylesheet. 7057 * 7058 * @syscap SystemCapability.Web.Webview.Core 7059 * @since 12 7060 */ 7061 STYLE_SHEET = 2, 7062 7063 /** 7064 * External script. 7065 * 7066 * @syscap SystemCapability.Web.Webview.Core 7067 * @since 12 7068 */ 7069 SCRIPT = 3, 7070 7071 /** 7072 * Image (jpg/gif/png/etc). 7073 * 7074 * @syscap SystemCapability.Web.Webview.Core 7075 * @since 12 7076 */ 7077 IMAGE = 4, 7078 7079 /** 7080 * Font. 7081 * 7082 * @syscap SystemCapability.Web.Webview.Core 7083 * @since 12 7084 */ 7085 FONT_RESOURCE = 5, 7086 7087 /** 7088 * Some other subresource. This is the default type if the actual type is unknown. 7089 * 7090 * @syscap SystemCapability.Web.Webview.Core 7091 * @since 12 7092 */ 7093 SUB_RESOURCE = 6, 7094 7095 /** 7096 * Object (or embed) tag for a plugin, or a resource that a plugin requested. 7097 * 7098 * @syscap SystemCapability.Web.Webview.Core 7099 * @since 12 7100 */ 7101 OBJECT = 7, 7102 7103 /** 7104 * Media resource. 7105 * 7106 * @syscap SystemCapability.Web.Webview.Core 7107 * @since 12 7108 */ 7109 MEDIA = 8, 7110 7111 /** 7112 * Main resource of a dedicated worker. 7113 * 7114 * @syscap SystemCapability.Web.Webview.Core 7115 * @since 12 7116 */ 7117 WORKER = 9, 7118 7119 /** 7120 * Main resource of a shared worker. 7121 * 7122 * @syscap SystemCapability.Web.Webview.Core 7123 * @since 12 7124 */ 7125 SHARED_WORKER = 10, 7126 7127 /** 7128 * Explicitly requested prefetch. 7129 * 7130 * @syscap SystemCapability.Web.Webview.Core 7131 * @since 12 7132 */ 7133 PREFETCH = 11, 7134 7135 /** 7136 * Favicon. 7137 * 7138 * @syscap SystemCapability.Web.Webview.Core 7139 * @since 12 7140 */ 7141 FAVICON = 12, 7142 7143 /** 7144 * XMLHttpRequest. 7145 * 7146 * @syscap SystemCapability.Web.Webview.Core 7147 * @since 12 7148 */ 7149 XHR = 13, 7150 7151 /** 7152 * Ping request for <a ping>/sendBeacon. 7153 * 7154 * @syscap SystemCapability.Web.Webview.Core 7155 * @since 12 7156 */ 7157 PING = 14, 7158 7159 /** 7160 * The main resource of a service worker. 7161 * 7162 * @syscap SystemCapability.Web.Webview.Core 7163 * @since 12 7164 */ 7165 SERVICE_WORKER = 15, 7166 7167 /** 7168 * Report of Content Security Policy violations. 7169 * 7170 * @syscap SystemCapability.Web.Webview.Core 7171 * @since 12 7172 */ 7173 CSP_REPORT = 16, 7174 7175 /** 7176 * Resource that a plugin requested. 7177 * 7178 * @syscap SystemCapability.Web.Webview.Core 7179 * @since 12 7180 */ 7181 PLUGIN_RESOURCE = 17, 7182 7183 /** 7184 * A main-frame service worker navigation preload request. 7185 * 7186 * @syscap SystemCapability.Web.Webview.Core 7187 * @since 12 7188 */ 7189 NAVIGATION_PRELOAD_MAIN_FRAME = 19, 7190 7191 /** 7192 * A sub-frame service worker navigation preload request. 7193 * 7194 * @syscap SystemCapability.Web.Webview.Core 7195 * @since 12 7196 */ 7197 NAVIGATION_PRELOAD_SUB_FRAME = 20, 7198 } 7199 7200 /** 7201 * Defines the Web resource request used for scheme handler. 7202 * 7203 * @syscap SystemCapability.Web.Webview.Core 7204 * @atomicservice 7205 * @since 12 7206 */ 7207 class WebSchemeHandlerRequest { 7208 /** 7209 * Gets request headers. 7210 * 7211 * @returns { Array<WebHeader> } Return the request headers. 7212 * @syscap SystemCapability.Web.Webview.Core 7213 * @atomicservice 7214 * @since 12 7215 */ 7216 getHeader(): Array<WebHeader>; 7217 /** 7218 * Gets the request URL. 7219 * 7220 * @returns { string } Return the request URL. 7221 * @syscap SystemCapability.Web.Webview.Core 7222 * @atomicservice 7223 * @since 12 7224 */ 7225 getRequestUrl(): string; 7226 /** 7227 * Get request method. 7228 * 7229 * @returns { string } Return the request method. 7230 * @syscap SystemCapability.Web.Webview.Core 7231 * @atomicservice 7232 * @since 12 7233 */ 7234 getRequestMethod(): string; 7235 /** 7236 * Get referrer of request. 7237 * 7238 * @returns { string } Return referrer of request. 7239 * @syscap SystemCapability.Web.Webview.Core 7240 * @atomicservice 7241 * @since 12 7242 */ 7243 getReferrer(): string; 7244 /** 7245 * Check whether the request is for getting the main frame. 7246 * 7247 * @returns { boolean } Whether request is main frame. 7248 * @syscap SystemCapability.Web.Webview.Core 7249 * @atomicservice 7250 * @since 12 7251 */ 7252 isMainFrame(): boolean; 7253 /** 7254 * Check whether the request is associated with gesture. 7255 * 7256 * @returns { boolean } Whether request has user gesture. 7257 * @syscap SystemCapability.Web.Webview.Core 7258 * @atomicservice 7259 * @since 12 7260 */ 7261 hasGesture(): boolean; 7262 /** 7263 * Get http body stream. 7264 * 7265 * @returns { WebHttpBodyStream | null } Return http body stream. If request has no http body stream, return null. 7266 * @syscap SystemCapability.Web.Webview.Core 7267 * @atomicservice 7268 * @since 12 7269 */ 7270 getHttpBodyStream(): WebHttpBodyStream | null; 7271 /** 7272 * Get request's resource type. 7273 * 7274 * @returns { WebResourceType } Return the request's resource type. 7275 * @syscap SystemCapability.Web.Webview.Core 7276 * @since 12 7277 */ 7278 getRequestResourceType(): WebResourceType; 7279 /** 7280 * Gets the URL of frame which trigger this request. 7281 * 7282 * @returns { string } Return the URL of frame which trigger this request. 7283 * @syscap SystemCapability.Web.Webview.Core 7284 * @since 12 7285 */ 7286 getFrameUrl(): string; 7287 } 7288 7289 /** 7290 * Defines the Web resource response used for scheme handler. 7291 * 7292 * @syscap SystemCapability.Web.Webview.Core 7293 * @atomicservice 7294 * @since 12 7295 */ 7296 class WebSchemeHandlerResponse { 7297 /** 7298 * Constructor. 7299 * 7300 * @syscap SystemCapability.Web.Webview.Core 7301 * @atomicservice 7302 * @since 12 7303 */ 7304 constructor(); 7305 /** 7306 * Set the resolved URL after redirects or changed as a result of HSTS. 7307 * 7308 * @param { string } url - Set response url for redirects. 7309 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types. 7310 * @syscap SystemCapability.Web.Webview.Core 7311 * @atomicservice 7312 * @since 12 7313 */ 7314 setUrl(url: string): void; 7315 /** 7316 * Get the resolved URL after redirects or changed as a result of HSTS. 7317 * 7318 * @returns { string } Return response url for redirects. 7319 * @syscap SystemCapability.Web.Webview.Core 7320 * @atomicservice 7321 * @since 12 7322 */ 7323 getUrl(): string; 7324 /** 7325 * Set net error code. 7326 * @param { WebNetErrorList } code - Set net error code. 7327 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 7328 * <br>2. Incorrect parameter types. 7329 * @syscap SystemCapability.Web.Webview.Core 7330 * @atomicservice 7331 * @since 12 7332 */ 7333 setNetErrorCode(code: WebNetErrorList): void; 7334 /** 7335 * Get net error code. 7336 * 7337 * @returns { WebNetErrorList } Return response error code. 7338 * @syscap SystemCapability.Web.Webview.Core 7339 * @atomicservice 7340 * @since 12 7341 */ 7342 getNetErrorCode(): WebNetErrorList; 7343 /** 7344 * Set http status code. 7345 * 7346 * @param { number } code - Http status code. 7347 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types. 7348 * @syscap SystemCapability.Web.Webview.Core 7349 * @atomicservice 7350 * @since 12 7351 */ 7352 setStatus(code: number): void; 7353 /** 7354 * Get http status code. 7355 * 7356 * @returns { number } Return http status code. 7357 * @syscap SystemCapability.Web.Webview.Core 7358 * @atomicservice 7359 * @since 12 7360 */ 7361 getStatus(): number; 7362 /** 7363 * Set status text. 7364 * 7365 * @param { string } text - Status text. 7366 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types. 7367 * @syscap SystemCapability.Web.Webview.Core 7368 * @atomicservice 7369 * @since 12 7370 */ 7371 setStatusText(text: string): void; 7372 /** 7373 * Get status text. 7374 * 7375 * @returns { string } Return http status text. 7376 * @syscap SystemCapability.Web.Webview.Core 7377 * @atomicservice 7378 * @since 12 7379 */ 7380 getStatusText(): string; 7381 /** 7382 * Set mime type. 7383 * 7384 * @param { string } type - Mime type. 7385 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types. 7386 * @syscap SystemCapability.Web.Webview.Core 7387 * @atomicservice 7388 * @since 12 7389 */ 7390 setMimeType(type: string): void; 7391 /** 7392 * Get mime type. 7393 * 7394 * @returns { string } Return mime type of response. 7395 * @syscap SystemCapability.Web.Webview.Core 7396 * @atomicservice 7397 * @since 12 7398 */ 7399 getMimeType(): string; 7400 /** 7401 * Set the response encoding. 7402 * 7403 * @param { string } encoding - Encoding. 7404 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types. 7405 * @syscap SystemCapability.Web.Webview.Core 7406 * @atomicservice 7407 * @since 12 7408 */ 7409 setEncoding(encoding: string): void; 7410 /** 7411 * Get the response encoding. 7412 * 7413 * @returns { string } Return encoding of response. 7414 * @syscap SystemCapability.Web.Webview.Core 7415 * @atomicservice 7416 * @since 12 7417 */ 7418 getEncoding(): string; 7419 /** 7420 * Set response hander value by name. 7421 * 7422 * @param { string } name - Header name. 7423 * @param { string } value - Header value. 7424 * @param { boolean } overwrite - Whether to overwrite. 7425 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 7426 * <br>2. Incorrect parameter types. 7427 * @syscap SystemCapability.Web.Webview.Core 7428 * @atomicservice 7429 * @since 12 7430 */ 7431 setHeaderByName(name: string, value: string, overwrite: boolean): void; 7432 /** 7433 * Get the header value by name from the response. 7434 * 7435 * @param { string } name - Header name. 7436 * @returns { string } Return header value by name. 7437 * @syscap SystemCapability.Web.Webview.Core 7438 * @atomicservice 7439 * @since 12 7440 */ 7441 getHeaderByName(name: string): string 7442 } 7443 7444 /** 7445 * Used to intercept url requests. Response headers and body can be sent through 7446 * WebResourceHandler. 7447 * 7448 * @syscap SystemCapability.Web.Webview.Core 7449 * @atomicservice 7450 * @since 12 7451 */ 7452 class WebResourceHandler { 7453 /** 7454 * Pass response headers to intercepted requests. 7455 * 7456 * @param { WebSchemeHandlerResponse } response - Set response header to intercept. 7457 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 7458 * @throws { BusinessError } 17100021 - The resource handler is invalid. 7459 * @syscap SystemCapability.Web.Webview.Core 7460 * @atomicservice 7461 * @since 12 7462 */ 7463 didReceiveResponse(response: WebSchemeHandlerResponse): void; 7464 /** 7465 * Pass response body data to intercepted requests. 7466 * 7467 * @param { ArrayBuffer } data - Set response body to intercept. 7468 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 7469 * @throws { BusinessError } 17100021 - The resource handler is invalid. 7470 * @syscap SystemCapability.Web.Webview.Core 7471 * @atomicservice 7472 * @since 12 7473 */ 7474 didReceiveResponseBody(data: ArrayBuffer): void; 7475 /** 7476 * Notify that this request should be finished and there is no more data available. 7477 * 7478 * @throws { BusinessError } 17100021 - The resource handler is invalid. 7479 * @syscap SystemCapability.Web.Webview.Core 7480 * @atomicservice 7481 * @since 12 7482 */ 7483 didFinish(): void; 7484 /** 7485 * Notify that this request should be failed. 7486 * 7487 * @param { WebNetErrorList } code - Set response error code to intercept. 7488 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types. 7489 * @throws { BusinessError } 17100021 - The resource handler is invalid. 7490 * @syscap SystemCapability.Web.Webview.Core 7491 * @atomicservice 7492 * @since 12 7493 */ 7494 didFail(code: WebNetErrorList): void; 7495 } 7496 7497 /** 7498 * This class is used to intercept requests for a specified scheme. 7499 * 7500 * @syscap SystemCapability.Web.Webview.Core 7501 * @atomicservice 7502 * @since 12 7503 */ 7504 class WebSchemeHandler { 7505 /** 7506 * Callback for handling the request. 7507 * 7508 * @param { function } callback - Callback of handling the request. If callback return false, 7509 * it means no interception. 7510 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 7511 * <br>2. Incorrect parameter types. 7512 * @syscap SystemCapability.Web.Webview.Core 7513 * @atomicservice 7514 * @since 12 7515 */ 7516 onRequestStart( 7517 callback: (request: WebSchemeHandlerRequest, handler: WebResourceHandler) => boolean): void; 7518 7519 /** 7520 * Callback when the request is completed. 7521 * 7522 * @param { Callback<WebSchemeHandlerRequest> } callback - Callback of request is completed. 7523 * @throws { BusinessError } 401 - Invalid input parameter. 7524 * @syscap SystemCapability.Web.Webview.Core 7525 * @atomicservice 7526 * @since 12 7527 */ 7528 onRequestStop(callback: Callback<WebSchemeHandlerRequest>): void; 7529 } 7530 7531 /** 7532 * Enum type supplied to {@link handleStatusChanged} for indicating the playback status. 7533 * @enum {number} 7534 * @syscap SystemCapability.Web.Webview.Core 7535 * @atomicservice 7536 * @since 12 7537 */ 7538 enum PlaybackStatus { 7539 /** 7540 * Player status is paused. 7541 * @syscap SystemCapability.Web.Webview.Core 7542 * @atomicservice 7543 * @since 12 7544 */ 7545 PAUSED = 0, 7546 /** 7547 * Player status is playing. 7548 * @syscap SystemCapability.Web.Webview.Core 7549 * @atomicservice 7550 * @since 12 7551 */ 7552 PLAYING, 7553 } 7554 7555 /** 7556 * Enum type supplied to {@link handleNetworkStateChanged} for indicating the native player network state. 7557 * @enum {number} 7558 * @syscap SystemCapability.Web.Webview.Core 7559 * @atomicservice 7560 * @since 12 7561 */ 7562 enum NetworkState { 7563 /** 7564 * Player does not do any download tasks. 7565 * @syscap SystemCapability.Web.Webview.Core 7566 * @atomicservice 7567 * @since 12 7568 */ 7569 EMPTY = 0, 7570 /** 7571 * Player downloads finished, waiting for next task. 7572 * @syscap SystemCapability.Web.Webview.Core 7573 * @atomicservice 7574 * @since 12 7575 */ 7576 IDLE, 7577 /** 7578 * Player is downloading contents. 7579 * @syscap SystemCapability.Web.Webview.Core 7580 * @atomicservice 7581 * @since 12 7582 */ 7583 LOADING, 7584 /** 7585 * Player downloads failed, due to network error. 7586 * @syscap SystemCapability.Web.Webview.Core 7587 * @atomicservice 7588 * @since 12 7589 */ 7590 NETWORK_ERROR 7591 } 7592 7593 /** 7594 * Enum type supplied to {@link handleReadyStateChanged} for indicating the native player network state. 7595 * @enum {number} 7596 * @syscap SystemCapability.Web.Webview.Core 7597 * @atomicservice 7598 * @since 12 7599 */ 7600 enum ReadyState { 7601 /** 7602 * Player hasn't downloaded anything. 7603 * @syscap SystemCapability.Web.Webview.Core 7604 * @atomicservice 7605 * @since 12 7606 */ 7607 HAVE_NOTHING = 0, 7608 /** 7609 * Player has downloaded metadata. 7610 * @syscap SystemCapability.Web.Webview.Core 7611 * @atomicservice 7612 * @since 12 7613 */ 7614 HAVE_METADATA, 7615 /** 7616 * Player has played all downloaded media data. 7617 * @syscap SystemCapability.Web.Webview.Core 7618 * @atomicservice 7619 * @since 12 7620 */ 7621 HAVE_CURRENT_DATA, 7622 /** 7623 * The buffered media data is not enough, and will cause jank. 7624 * @syscap SystemCapability.Web.Webview.Core 7625 * @atomicservice 7626 * @since 12 7627 */ 7628 HAVE_FUTURE_DATA, 7629 /** 7630 * The buffered media data is enough. 7631 * @syscap SystemCapability.Web.Webview.Core 7632 * @atomicservice 7633 * @since 12 7634 */ 7635 HAVE_ENOUGH_DATA, 7636 } 7637 7638 /** 7639 * Enum type supplied to {@link handleError} for indicating the error type of native media player. 7640 * @enum {number} 7641 * @syscap SystemCapability.Web.Webview.Core 7642 * @atomicservice 7643 * @since 12 7644 */ 7645 enum MediaError { 7646 /** 7647 * Network error 7648 * @syscap SystemCapability.Web.Webview.Core 7649 * @atomicservice 7650 * @since 12 7651 */ 7652 NETWORK_ERROR = 1, 7653 /** 7654 * Media format error, such as not a valid file. 7655 * @syscap SystemCapability.Web.Webview.Core 7656 * @atomicservice 7657 * @since 12 7658 */ 7659 FORMAT_ERROR, 7660 /** 7661 * Decode error, such as decoder doesn't support this format. 7662 * @syscap SystemCapability.Web.Webview.Core 7663 * @atomicservice 7664 * @since 12 7665 */ 7666 DECODE_ERROR 7667 } 7668 7669 /** 7670 * The native media player status handler. 7671 * Apps should use this class to handle native media player's status. 7672 * 7673 * @typedef NativeMediaPlayerHandler 7674 * @syscap SystemCapability.Web.Webview.Core 7675 * @atomicservice 7676 * @since 12 7677 */ 7678 interface NativeMediaPlayerHandler { 7679 7680 /** 7681 * Handle native media player playback status. 7682 * 7683 * @param { PlaybackStatus } status - Playback status of native media player. 7684 * @syscap SystemCapability.Web.Webview.Core 7685 * @atomicservice 7686 * @since 12 7687 */ 7688 handleStatusChanged(status: PlaybackStatus): void 7689 7690 /** 7691 * Handle native media player volume. 7692 * volume: float 7693 * value range: [0 - 1.0] 7694 * 7695 * @param { number } volume - Current volume of native media player. 7696 * @syscap SystemCapability.Web.Webview.Core 7697 * @atomicservice 7698 * @since 12 7699 */ 7700 handleVolumeChanged(volume: number): void 7701 7702 /** 7703 * Handle native media player muted status. 7704 * 7705 * @param { boolean } muted - Current mute status of native media player. 7706 * @syscap SystemCapability.Web.Webview.Core 7707 * @atomicservice 7708 * @since 12 7709 */ 7710 handleMutedChanged(muted: boolean): void 7711 7712 /** 7713 * Handle playback rate of native media player. 7714 * playbackRate: float 7715 * value range: [0 - infinity] 7716 * 7717 * @param { number } playbackRate - Current playback rate of native media player. 7718 * @syscap SystemCapability.Web.Webview.Core 7719 * @atomicservice 7720 * @since 12 7721 */ 7722 handlePlaybackRateChanged(playbackRate: number): void 7723 7724 /** 7725 * Handle duration time of media. 7726 * duration: float 7727 * value range: [0 - infinity] 7728 * 7729 * @param { number } duration - Duration time (in seconds) of media. 7730 * @syscap SystemCapability.Web.Webview.Core 7731 * @atomicservice 7732 * @since 12 7733 */ 7734 handleDurationChanged(duration: number): void 7735 7736 /** 7737 * Handle current playing time of media. 7738 * currentPlayTime: float 7739 * value range: [0 - duration] 7740 * 7741 * @param { number } currentPlayTime - Current playing time (in seconds) of media. 7742 * @syscap SystemCapability.Web.Webview.Core 7743 * @atomicservice 7744 * @since 12 7745 */ 7746 handleTimeUpdate(currentPlayTime: number): void 7747 7748 /** 7749 * Handle buffered end time of media. 7750 * bufferedEndTime: float 7751 * value range: [0 - duration] 7752 * 7753 * @param { number } bufferedEndTime - Buffered end time (in seconds) of media. 7754 * @syscap SystemCapability.Web.Webview.Core 7755 * @atomicservice 7756 * @since 12 7757 */ 7758 handleBufferedEndTimeChanged(bufferedEndTime: number): void 7759 7760 /** 7761 * Handle native player ended event. 7762 * 7763 * @syscap SystemCapability.Web.Webview.Core 7764 * @atomicservice 7765 * @since 12 7766 */ 7767 handleEnded(): void 7768 7769 /** 7770 * Handle network state of native media player. 7771 * 7772 * @param { NetworkState } state - Network state of native media player. 7773 * @syscap SystemCapability.Web.Webview.Core 7774 * @atomicservice 7775 * @since 12 7776 */ 7777 handleNetworkStateChanged(state: NetworkState): void 7778 7779 /** 7780 * Handle ready state of native media player. 7781 * 7782 * @param { ReadyState } state - Ready state of native media player. 7783 * @syscap SystemCapability.Web.Webview.Core 7784 * @atomicservice 7785 * @since 12 7786 */ 7787 handleReadyStateChanged(state: ReadyState): void 7788 7789 /** 7790 * Handle native media player fullscreen state changed event. 7791 * 7792 * @param { boolean } fullscreen - Fullscreen state of native media player. 7793 * @syscap SystemCapability.Web.Webview.Core 7794 * @atomicservice 7795 * @since 12 7796 */ 7797 handleFullscreenChanged(fullscreen: boolean): void 7798 7799 /** 7800 * Handle native media player seeking state. 7801 * 7802 * @syscap SystemCapability.Web.Webview.Core 7803 * @atomicservice 7804 * @since 12 7805 */ 7806 handleSeeking(): void 7807 7808 /** 7809 * Handle native media player seek finished state. 7810 * 7811 * @syscap SystemCapability.Web.Webview.Core 7812 * @atomicservice 7813 * @since 12 7814 */ 7815 handleSeekFinished(): void 7816 7817 /** 7818 * Handle native media player error event. 7819 * 7820 * @param { MediaError } error - Error type of native media player. 7821 * @param { string } errorMessage - Description of current error. 7822 * @syscap SystemCapability.Web.Webview.Core 7823 * @atomicservice 7824 * @since 12 7825 */ 7826 handleError(error: MediaError, errorMessage: string): void 7827 7828 /** 7829 * Handle size of video. 7830 * 7831 * @param { number } width - Width of video. 7832 * @param { number } height - Height of video. 7833 * @syscap SystemCapability.Web.Webview.Core 7834 * @atomicservice 7835 * @since 12 7836 */ 7837 handleVideoSizeChanged(width: number, height: number): void 7838 } 7839 7840 /** 7841 * The scenarios for suspending the media player. 7842 * @enum {number} 7843 * @syscap SystemCapability.Web.Webview.Core 7844 * @since 12 7845 */ 7846 enum SuspendType { 7847 /** 7848 * Page enters the BackForwardCache. 7849 * @syscap SystemCapability.Web.Webview.Core 7850 * @since 12 7851 */ 7852 ENTER_BACK_FORWARD_CACHE = 0, 7853 7854 /** 7855 * Page enters background. 7856 * @syscap SystemCapability.Web.Webview.Core 7857 * @since 12 7858 */ 7859 ENTER_BACKGROUND, 7860 7861 /** 7862 * Cleanup when the number of paused media player over limit. 7863 * @syscap SystemCapability.Web.Webview.Core 7864 * @since 12 7865 */ 7866 AUTO_CLEANUP 7867 } 7868 7869 /** 7870 * The bridge between web core and native media player. 7871 * Apps should implements this interface, and pass an instance to web core. 7872 * Then web core can control native media player by this bridge. 7873 * 7874 * @typedef NativeMediaPlayerBridge 7875 * @syscap SystemCapability.Web.Webview.Core 7876 * @atomicservice 7877 * @since 12 7878 */ 7879 interface NativeMediaPlayerBridge { 7880 /** 7881 * Notify native media player that the rect of video tag has changed. 7882 * 7883 * @param { number } x - The x position of video tag in web component. 7884 * @param { number } y - The y position of video tag in web component. 7885 * @param { number } width - The width of video tag. 7886 * @param { number } height - The height of video tag. 7887 * @syscap SystemCapability.Web.Webview.Core 7888 * @atomicservice 7889 * @since 12 7890 */ 7891 updateRect(x: number, y: number, width: number, height: number): void 7892 7893 /** 7894 * Request to play. 7895 * 7896 * @syscap SystemCapability.Web.Webview.Core 7897 * @atomicservice 7898 * @since 12 7899 */ 7900 play(): void 7901 7902 /** 7903 * Request to pause. 7904 * 7905 * @syscap SystemCapability.Web.Webview.Core 7906 * @atomicservice 7907 * @since 12 7908 */ 7909 pause(): void 7910 7911 /** 7912 * Request to fast forward / back forward to targetTime. 7913 * targetTime: float 7914 * value range: [0 - duration] 7915 * 7916 * @param { number } targetTime - The target time (in seconds) to FF/BF to. 7917 * @syscap SystemCapability.Web.Webview.Core 7918 * @atomicservice 7919 * @since 12 7920 */ 7921 seek(targetTime: number): void 7922 7923 /** 7924 * Request to change volume of native media player. 7925 * volume: float 7926 * value range: [0 - 1.0] 7927 * 7928 * @param { number } volume - The volume of native media player. 7929 * @syscap SystemCapability.Web.Webview.Core 7930 * @atomicservice 7931 * @since 12 7932 */ 7933 setVolume(volume: number): void 7934 7935 /** 7936 * Request to mute native media player. 7937 * 7938 * @param { boolean } muted - Should mute native media player. 7939 * @syscap SystemCapability.Web.Webview.Core 7940 * @atomicservice 7941 * @since 12 7942 */ 7943 setMuted(muted: boolean): void 7944 7945 /** 7946 * Request to change playback rate of native media player. 7947 * playbackRate: float 7948 * value range: [0 - 10.0] 7949 * 7950 * @param { number } playbackRate - The playback rate of native media player. 7951 * @syscap SystemCapability.Web.Webview.Core 7952 * @atomicservice 7953 * @since 12 7954 */ 7955 setPlaybackRate(playbackRate: number): void 7956 7957 /** 7958 * Request to release native media player. 7959 * 7960 * @syscap SystemCapability.Web.Webview.Core 7961 * @atomicservice 7962 * @since 12 7963 */ 7964 release(): void 7965 7966 /** 7967 * Request to enter fullscreen. 7968 * 7969 * @syscap SystemCapability.Web.Webview.Core 7970 * @atomicservice 7971 * @since 12 7972 */ 7973 enterFullscreen(): void 7974 7975 /** 7976 * Request to exit fullscreen. 7977 * 7978 * @syscap SystemCapability.Web.Webview.Core 7979 * @atomicservice 7980 * @since 12 7981 */ 7982 exitFullscreen(): void 7983 7984 /** 7985 * Resume the native media player. 7986 * 7987 * @syscap SystemCapability.Web.Webview.Core 7988 * @since 12 7989 */ 7990 resumePlayer?(): void 7991 7992 /** 7993 * Suspend to release native media player, not the NativeMediaPlayerBridge. The 7994 * embedder should save the status of player when release the native media player 7995 * through NativeMediaPlayerBridge. 7996 * 7997 * @param { SuspendType } type - The scenario for suspending the media player. 7998 * @syscap SystemCapability.Web.Webview.Core 7999 * @since 12 8000 */ 8001 suspendPlayer?(type: SuspendType): void 8002 } 8003 8004 /** 8005 * Enum type for indicating the media type of native media player. 8006 * @enum {number} 8007 * @syscap SystemCapability.Web.Webview.Core 8008 * @atomicservice 8009 * @since 12 8010 */ 8011 enum MediaType { 8012 /** 8013 * Media type is video. 8014 * @syscap SystemCapability.Web.Webview.Core 8015 * @atomicservice 8016 * @since 12 8017 */ 8018 VIDEO = 0, 8019 /** 8020 * Media type is audio. 8021 * @syscap SystemCapability.Web.Webview.Core 8022 * @atomicservice 8023 * @since 12 8024 */ 8025 AUDIO 8026 } 8027 8028 /** 8029 * Enum type for indicating the media source type of native media player. 8030 * @enum {number} 8031 * @syscap SystemCapability.Web.Webview.Core 8032 * @atomicservice 8033 * @since 12 8034 */ 8035 enum SourceType { 8036 /** 8037 * Source type is URL. 8038 * @syscap SystemCapability.Web.Webview.Core 8039 * @atomicservice 8040 * @since 12 8041 */ 8042 URL = 0, 8043 /** 8044 * Source type is blob. 8045 * @syscap SystemCapability.Web.Webview.Core 8046 * @atomicservice 8047 * @since 12 8048 */ 8049 MSE 8050 } 8051 8052 /** 8053 * Media source information. Uri and format. 8054 * 8055 * @syscap SystemCapability.Web.Webview.Core 8056 * @atomicservice 8057 * @since 12 8058 */ 8059 class MediaSourceInfo { 8060 /** 8061 * Source type, most time is URL. 8062 * @type { SourceType } 8063 * @syscap SystemCapability.Web.Webview.Core 8064 * @since 12 8065 */ 8066 type: SourceType; 8067 8068 /** 8069 * Media source, most time is Uri. 8070 * @type { string } 8071 * @syscap SystemCapability.Web.Webview.Core 8072 * @atomicservice 8073 * @since 12 8074 */ 8075 source: string; 8076 8077 /** 8078 * Media format, such as mp4, webm, m3u8 etc. 8079 * @type { string } 8080 * @syscap SystemCapability.Web.Webview.Core 8081 * @atomicservice 8082 * @since 12 8083 */ 8084 format: string; 8085 } 8086 8087 /** 8088 * Rectangle definition. 8089 * 8090 * @typedef RectEvent 8091 * @syscap SystemCapability.Web.Webview.Core 8092 * @since 12 8093 */ 8094 interface RectEvent { 8095 /** 8096 * X coordinator of top left point. 8097 * 8098 * @type { number } 8099 * @syscap SystemCapability.Web.Webview.Core 8100 * @since 12 8101 */ 8102 x: number; 8103 /** 8104 * Y coordinator of top left point. 8105 * 8106 * @type { number } 8107 * @syscap SystemCapability.Web.Webview.Core 8108 * @since 12 8109 */ 8110 y: number; 8111 /** 8112 * Width of this rectangle. 8113 * 8114 * @type { number } 8115 * @syscap SystemCapability.Web.Webview.Core 8116 * @since 12 8117 */ 8118 width: number; 8119 /** 8120 * Height of this rectangle. 8121 * 8122 * @type { number } 8123 * @syscap SystemCapability.Web.Webview.Core 8124 * @since 12 8125 */ 8126 height: number; 8127 } 8128 8129 /** 8130 * Surface information. 8131 * 8132 * @syscap SystemCapability.Web.Webview.Core 8133 * @atomicservice 8134 * @since 12 8135 */ 8136 class NativeMediaPlayerSurfaceInfo { 8137 /** 8138 * Id of surface. 8139 * @type { string } 8140 * @syscap SystemCapability.Web.Webview.Core 8141 * @atomicservice 8142 * @since 12 8143 */ 8144 id: string; 8145 8146 /** 8147 * Surface rect info. 8148 * @type { RectEvent } 8149 * @syscap SystemCapability.Web.Webview.Core 8150 * @since 12 8151 */ 8152 rect: RectEvent; 8153 } 8154 8155 /** 8156 * Enum type for indicating the preload type. 8157 * @enum {number} 8158 * @syscap SystemCapability.Web.Webview.Core 8159 * @atomicservice 8160 * @since 12 8161 */ 8162 enum Preload { 8163 /** 8164 * Doesn't do preload. 8165 * @syscap SystemCapability.Web.Webview.Core 8166 * @atomicservice 8167 * @since 12 8168 */ 8169 NONE = 0, 8170 /** 8171 * Only preload metadata. 8172 * @syscap SystemCapability.Web.Webview.Core 8173 * @atomicservice 8174 * @since 12 8175 */ 8176 METADATA, 8177 /** 8178 * Preload enough data to ensure playing is smooth. 8179 * @syscap SystemCapability.Web.Webview.Core 8180 * @atomicservice 8181 * @since 12 8182 */ 8183 AUTO 8184 } 8185 8186 /** 8187 * Media information. 8188 * 8189 * @typedef MediaInfo 8190 * @syscap SystemCapability.Web.Webview.Core 8191 * @atomicservice 8192 * @since 12 8193 */ 8194 interface MediaInfo { 8195 /** 8196 * Id of media element. 8197 * @type { string } 8198 * @syscap SystemCapability.Web.Webview.Core 8199 * @since 12 8200 */ 8201 embedID: string, 8202 /** 8203 * Media type : Video or Audio. 8204 * @type { MediaType } 8205 * @syscap SystemCapability.Web.Webview.Core 8206 * @atomicservice 8207 * @since 12 8208 */ 8209 mediaType: MediaType, 8210 /** 8211 * Media source list, player should choose an appropriate one to play. 8212 * @type { MediaSourceInfo[] } 8213 * @syscap SystemCapability.Web.Webview.Core 8214 * @atomicservice 8215 * @since 12 8216 */ 8217 mediaSrcList: MediaSourceInfo[], 8218 /** 8219 * Surface to render media content on. 8220 * @type { NativeMediaPlayerSurfaceInfo } 8221 * @syscap SystemCapability.Web.Webview.Core 8222 * @atomicservice 8223 * @since 12 8224 */ 8225 surfaceInfo: NativeMediaPlayerSurfaceInfo, 8226 /** 8227 * Should show media controls. 8228 * @type { boolean } 8229 * @syscap SystemCapability.Web.Webview.Core 8230 * @atomicservice 8231 * @since 12 8232 */ 8233 controlsShown: boolean, 8234 /** 8235 * Limit media controls items. 8236 * Such as 'nodownload', 'nofullscreen', 'noremoteplayback' 8237 * @type { string[] } 8238 * @syscap SystemCapability.Web.Webview.Core 8239 * @atomicservice 8240 * @since 12 8241 */ 8242 controlList: string[], 8243 /** 8244 * Player should be muted; 8245 * @type { boolean } 8246 * @syscap SystemCapability.Web.Webview.Core 8247 * @atomicservice 8248 * @since 12 8249 */ 8250 muted: boolean, 8251 /** 8252 * Player should show poster before media first frame shown. 8253 * @type { string } 8254 * @syscap SystemCapability.Web.Webview.Core 8255 * @atomicservice 8256 * @since 12 8257 */ 8258 posterUrl: string, 8259 /** 8260 * Preload type. 8261 * @type { Preload } 8262 * @syscap SystemCapability.Web.Webview.Core 8263 * @atomicservice 8264 * @since 12 8265 */ 8266 preload: Preload, 8267 /** 8268 * Header information of a media network request. 8269 * @type { Record<string, string> } 8270 * @syscap SystemCapability.Web.Webview.Core 8271 * @since 12 8272 */ 8273 headers: Record<string, string>, 8274 /** 8275 * The information list of attributes of media tag. 8276 * @type { Record<string, string> } 8277 * @syscap SystemCapability.Web.Webview.Core 8278 * @since 12 8279 */ 8280 attributes: Record<string, string>, 8281 } 8282 8283 /** 8284 * The callback of creating a native media player. 8285 * 8286 * @typedef { function } 8287 * @param { NativeMediaPlayerHandler } handler - callback information of onCreateNativeMediaPlayer. 8288 * @param { MediaInfo } mediaInfo - callback information of onCreateNativeMediaPlayer. 8289 * @returns { NativeMediaPlayerBridge } Returns whether the app takes over the media. 8290 * @syscap SystemCapability.Web.Webview.Core 8291 * @atomicservice 8292 * @since 12 8293 */ 8294 type CreateNativeMediaPlayerCallback = 8295 (handler: NativeMediaPlayerHandler, mediaInfo: MediaInfo) => NativeMediaPlayerBridge; 8296 8297 /** 8298 * This class is used to set adblock config. 8299 * @syscap SystemCapability.Web.Webview.Core 8300 * @atomicservice 8301 * @since 12 8302 */ 8303 class AdsBlockManager { 8304 /** 8305 * set Ads Block ruleset file, containing easylist rules. 8306 * @param {string} rulesFile - absolute file path contains app customized ads block rules. 8307 * @param {boolean} replace - (@code true)replace internal rules;(@code false) add to internal rules. 8308 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 8309 * <br>2. Incorrect parameter types. 8310 * @syscap SystemCapability.Web.Webview.Core 8311 * @atomicservice 8312 * @since 12 8313 */ 8314 /** 8315 * set Ads Block ruleset file, containing easylist rules. 8316 * @param {string} rulesFile - absolute file path contains app customized ads block rules. 8317 * @param {boolean} replace - (@code true)replace internal rules;(@code false) add to internal rules. 8318 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 8319 * <br>2. Incorrect parameter types. 8320 * @throws { BusinessError } 801 - Capability not supported. 8321 * @syscap SystemCapability.Web.Webview.Core 8322 * @atomicservice 8323 * @since 18 8324 */ 8325 static setAdsBlockRules(rulesFile: string, replace: boolean): void; 8326 8327 /** 8328 * Add items to Ads Block Disallow list. 8329 * @param { Array<string> } domainSuffixes - list of domain suffix, if web page url matches someone in the list, 8330 * Ads Block will be disallowed for the web page. 8331 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 8332 * <br>2. Incorrect parameter types. 8333 * @syscap SystemCapability.Web.Webview.Core 8334 * @atomicservice 8335 * @since 12 8336 */ 8337 /** 8338 * Add items to Ads Block Disallow list. 8339 * @param { Array<string> } domainSuffixes - list of domain suffix, if web page url matches someone in the list, 8340 * Ads Block will be disallowed for the web page. 8341 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 8342 * <br>2. Incorrect parameter types. 8343 * @throws { BusinessError } 801 - Capability not supported. 8344 * @syscap SystemCapability.Web.Webview.Core 8345 * @atomicservice 8346 * @since 18 8347 */ 8348 static addAdsBlockDisallowedList(domainSuffixes: Array<string>): void; 8349 8350 /** 8351 * Add items to Ads Block Allow list. 8352 * By default, ads block is allowed for all pages unless they are added to the 8353 * disallow list. The priority of allowlist is higher than the disallowlist. It is 8354 * used to re-enable ads block on the page that matches disallow list. 8355 * @param { Array<string> } domainSuffixes - list of domain suffix, if web page url matches someone in the list, 8356 * Ads Block will be allowed for the web page. 8357 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 8358 * <br>2. Incorrect parameter types. 8359 * @syscap SystemCapability.Web.Webview.Core 8360 * @atomicservice 8361 * @since 12 8362 */ 8363 /** 8364 * Add items to Ads Block Allow list. 8365 * By default, ads block is allowed for all pages unless they are added to the 8366 * disallow list. The priority of allowlist is higher than the disallowlist. It is 8367 * used to re-enable ads block on the page that matches disallow list. 8368 * @param { Array<string> } domainSuffixes - list of domain suffix, if web page url matches someone in the list, 8369 * Ads Block will be allowed for the web page. 8370 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 8371 * <br>2. Incorrect parameter types. 8372 * @throws { BusinessError } 801 - Capability not supported. 8373 * @syscap SystemCapability.Web.Webview.Core 8374 * @atomicservice 8375 * @since 18 8376 */ 8377 static addAdsBlockAllowedList(domainSuffixes: Array<string>): void; 8378 8379 /** 8380 * remove items from Ads Block Disallowed list. 8381 * @param { Array<string> } domainSuffixes - list of domain suffix needed be removed from disallow list 8382 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 8383 * <br>2. Incorrect parameter types. 8384 * @syscap SystemCapability.Web.Webview.Core 8385 * @atomicservice 8386 * @since 12 8387 */ 8388 /** 8389 * remove items from Ads Block Disallowed list. 8390 * @param { Array<string> } domainSuffixes - list of domain suffix needed be removed from disallow list 8391 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 8392 * <br>2. Incorrect parameter types. 8393 * @throws { BusinessError } 801 - Capability not supported. 8394 * @syscap SystemCapability.Web.Webview.Core 8395 * @atomicservice 8396 * @since 18 8397 */ 8398 static removeAdsBlockDisallowedList(domainSuffixes: Array<string>): void; 8399 8400 /** 8401 * remove items from Ads Block Allowed list. 8402 * @param { Array<string> } domainSuffixes - list of domain suffix needed be removed from allow list 8403 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 8404 * <br>2. Incorrect parameter types. 8405 * @syscap SystemCapability.Web.Webview.Core 8406 * @atomicservice 8407 * @since 12 8408 */ 8409 /** 8410 * remove items from Ads Block Allowed list. 8411 * @param { Array<string> } domainSuffixes - list of domain suffix needed be removed from allow list 8412 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 8413 * <br>2. Incorrect parameter types. 8414 * @throws { BusinessError } 801 - Capability not supported. 8415 * @syscap SystemCapability.Web.Webview.Core 8416 * @atomicservice 8417 * @since 18 8418 */ 8419 static removeAdsBlockAllowedList(domainSuffixes: Array<string>): void; 8420 8421 /** 8422 * clear Ads Block Disallowed list. 8423 * @syscap SystemCapability.Web.Webview.Core 8424 * @atomicservice 8425 * @since 12 8426 */ 8427 /** 8428 * clear Ads Block Disallowed list. 8429 * @throws { BusinessError } 801 - Capability not supported. 8430 * @syscap SystemCapability.Web.Webview.Core 8431 * @atomicservice 8432 * @since 18 8433 */ 8434 static clearAdsBlockDisallowedList(): void; 8435 8436 /** 8437 * clear Ads Block Allowed list. 8438 * @syscap SystemCapability.Web.Webview.Core 8439 * @atomicservice 8440 * @since 12 8441 */ 8442 /** 8443 * clear Ads Block Allowed list. 8444 * @throws { BusinessError } 801 - Capability not supported. 8445 * @syscap SystemCapability.Web.Webview.Core 8446 * @atomicservice 8447 * @since 18 8448 */ 8449 static clearAdsBlockAllowedList(): void; 8450 } 8451 8452 /** 8453 * This class is used to enable back forward cache supported features. 8454 * 8455 * @syscap SystemCapability.Web.Webview.Core 8456 * @since 12 8457 */ 8458 class BackForwardCacheSupportedFeatures { 8459 /** 8460 * Whether cache the pages that use native embed. 8461 * Default is false; 8462 * 8463 * @type { boolean } 8464 * @syscap SystemCapability.Web.Webview.Core 8465 * @since 12 8466 */ 8467 nativeEmbed: boolean; 8468 8469 /** 8470 * Whether cache the pages that use media take over. 8471 * Default is false; 8472 * 8473 * @type { boolean } 8474 * @syscap SystemCapability.Web.Webview.Core 8475 * @since 12 8476 */ 8477 mediaTakeOver: boolean; 8478 8479 /** 8480 * @syscap SystemCapability.Web.Webview.Core 8481 * @since 12 8482 */ 8483 constructor(); 8484 } 8485 8486 /** 8487 * This class is used to set back forward cache options. 8488 * 8489 * @syscap SystemCapability.Web.Webview.Core 8490 * @since 12 8491 */ 8492 class BackForwardCacheOptions { 8493 /** 8494 * Set the maximum size of pages that can cache. 8495 * Default is 1, max is 50. 8496 * 8497 * @type { number } 8498 * @syscap SystemCapability.Web.Webview.Core 8499 * @since 12 8500 */ 8501 size: number; 8502 8503 /** 8504 * Set the lifetime in seconds in the BackForwardCache. 8505 * Default is 600. 8506 * 8507 * @type { number } 8508 * @syscap SystemCapability.Web.Webview.Core 8509 * @since 12 8510 */ 8511 timeToLive: number; 8512 8513 /** 8514 * @syscap SystemCapability.Web.Webview.Core 8515 * @since 12 8516 */ 8517 constructor(); 8518 } 8519 8520 /** 8521 * Enum type supplied to {@link insertProxyRule} for indicating the scheme filter for proxy. 8522 * @enum { number } 8523 * @syscap SystemCapability.Web.Webview.Core 8524 * @since 15 8525 */ 8526 enum ProxySchemeFilter { 8527 /** 8528 * This indicates all the schemes will use the proxy. 8529 * @syscap SystemCapability.Web.Webview.Core 8530 * @since 15 8531 */ 8532 MATCH_ALL_SCHEMES = 0, 8533 /** 8534 * This indicates only the HTTP requests will use the proxy. 8535 * @syscap SystemCapability.Web.Webview.Core 8536 * @since 15 8537 */ 8538 MATCH_HTTP = 1, 8539 /** 8540 * This indicates only the HTTPS requests will use the proxy. 8541 * @syscap SystemCapability.Web.Webview.Core 8542 * @since 15 8543 */ 8544 MATCH_HTTPS = 2, 8545 } 8546 /** 8547 * The ProxyConfig used by applyProxyOverride. 8548 * 8549 * @syscap SystemCapability.Web.Webview.Core 8550 * @since 15 8551 */ 8552 class ProxyConfig { 8553 /** 8554 * Insert a bypass rule that indicates URLs that should skip the override proxy and connect the server directly instead. 8555 * These maybe URLs or IP addresses and wildcards are supported. e.g. "*.example.com" means that requests to 8556 * "https://www.example.com" and "http://test.example.com" will connect the server directly. 8557 * 8558 * @param { string } bypassRule - The bypass rule. 8559 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 8560 * <br>2. Incorrect parameter types. 8561 * @syscap SystemCapability.Web.Webview.Core 8562 * @since 15 8563 */ 8564 insertBypassRule(bypassRule: string): void; 8565 /** 8566 * Insert a proxy rule that indicates URLs that match the schemeFilter will connect the server directly. 8567 * 8568 * @param { ProxySchemeFilter } schemeFilter - The scheme filter for this rule. 8569 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 8570 * <br>2. Incorrect parameter types. 8571 * @syscap SystemCapability.Web.Webview.Core 8572 * @since 15 8573 */ 8574 insertDirectRule(schemeFilter?: ProxySchemeFilter): void; 8575 /** 8576 * Insert a proxy rule which indicates that requests matching the schemeFilter should use an override proxy, all requests will 8577 * use the proxy rule if schemeFilter is null. 8578 * 8579 * The format for proxy is [scheme://]host[:port]. Scheme is optional and must be HTTP, HTTPS, or SOCKS if present. Scheme defaults to HTTP. 8580 * Host is an IPv6 literal with brackets, an IPv4 literal or one or more labels seperated by a period. Port number is optional and defaults 8581 * to 80 for HTTP, 443 for HTTPS and 1080 for SOCKS. 8582 * 8583 * e.g. example.com host: example.com 8584 * https://example.com scheme: https host: example.com 8585 * example.com:8888 host: example.com port: 8888 8586 * https://example.com:8888 scheme:https host: example.com port:8888 8587 * 192.168.1.1 host: 192.168.1.1 8588 * 192.168.1.1:8888 host:192.168.1.1 port: 8888 8589 * [10:20:30:40:50:60:70:80] 8590 * 8591 * @param { string } proxyRule - The proxy rule. 8592 * @param { ProxySchemeFilter } schemeFilter - The scheme filter for this rule. 8593 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 8594 * <br>2. Incorrect parameter types. 8595 * @syscap SystemCapability.Web.Webview.Core 8596 * @since 15 8597 */ 8598 insertProxyRule(proxyRule: string, schemeFilter?: ProxySchemeFilter): void; 8599 /** 8600 * Hostnames without a period in them (and that are not IP literals) will skip the proxy and connect the server directly. 8601 * Examples: "abc", "local", "some-domain". 8602 * 8603 * @syscap SystemCapability.Web.Webview.Core 8604 * @since 15 8605 */ 8606 bypassHostnamesWithoutPeriod(): void; 8607 /** 8608 * By default, certain hostnames implicitly bypass the proxy if they are link-local IPs, or localhost addresses. For instance 8609 * hostnames matching any of (non-exhaustive list): localhost *.localhost [::1] 127.0.0.1/8 169.254/16 [FE80::]/10 8610 * Call this function to override the default behavior and force localhost and link-local URLs to be sent through the proxy. 8611 * 8612 * @syscap SystemCapability.Web.Webview.Core 8613 * @since 15 8614 */ 8615 clearImplicitRules(): void; 8616 /** 8617 * Reverse the bypass rules. 8618 * 8619 * If false all URLs will use proxy settings except URLs match the bypass rules. 8620 * If true only URLs in the bypass list will use proxy, and all other URLs will be connected to directly. 8621 * 8622 * @param { boolean } reverse - If reverse the bypass rule. 8623 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 8624 * <br>2. Incorrect parameter types. 8625 * @syscap SystemCapability.Web.Webview.Core 8626 * @since 15 8627 */ 8628 enableReverseBypass(reverse: boolean): void; 8629 /** 8630 * Returns the bypass rules. 8631 * 8632 * @returns { Array<string> } The bypass rules. 8633 * @syscap SystemCapability.Web.Webview.Core 8634 * @since 15 8635 */ 8636 getBypassRules(): Array<string>; 8637 /** 8638 * Returns the proxy rules. 8639 * 8640 * @returns { Array<ProxyRule> } The proxy rules. 8641 * @syscap SystemCapability.Web.Webview.Core 8642 * @since 15 8643 */ 8644 getProxyRules(): Array<ProxyRule>; 8645 /** 8646 * Returns if reverse bypass rules. 8647 * 8648 * @returns { boolean } If reverse bypass enabled. 8649 * @syscap SystemCapability.Web.Webview.Core 8650 * @since 15 8651 */ 8652 isReverseBypassEnabled(): boolean; 8653 } 8654 8655 /** 8656 * The ProxyRule used by insertProxyRule. 8657 * 8658 * @syscap SystemCapability.Web.Webview.Core 8659 * @since 15 8660 */ 8661 class ProxyRule { 8662 /** 8663 * Returns the scheme filter used for this rule. 8664 * 8665 * @returns { ProxySchemeFilter } The scheme filter used for this rule. 8666 * @syscap SystemCapability.Web.Webview.Core 8667 * @since 15 8668 */ 8669 getSchemeFilter(): ProxySchemeFilter; 8670 /** 8671 * Returns the proxy URL. 8672 * 8673 * @returns { string } The proxy URL. 8674 * @syscap SystemCapability.Web.Webview.Core 8675 * @since 15 8676 */ 8677 getUrl(): string; 8678 } 8679 8680 /** 8681 * The callback for proxy changed. 8682 * 8683 * @typedef { function } 8684 * @syscap SystemCapability.Web.Webview.Core 8685 * @since 15 8686 */ 8687 type OnProxyConfigChangeCallback = () => void; 8688 8689 /** 8690 * This class is used for set proxy for ArkWeb. 8691 * 8692 * @syscap SystemCapability.Web.Webview.Core 8693 * @since 15 8694 */ 8695 class ProxyController { 8696 /** 8697 * Sets ProxyConfig which will be used by all Webs in the app. URLs that match patterns in the bypass list will connect the server directly. 8698 * Instead, the request will use the proxy specified by the config. Requests are not guaranteed to use the new proxy immediately; wait for 8699 * the listener before loading a page. This listener will be called on the UI thread. 8700 * Note: calling applyProxyOverride will cause any existing system wide setting to be ignored. 8701 * 8702 * @param { ProxyConfig } proxyConfig - The proxy config. 8703 * @param { OnProxyConfigChangeCallback } callback - Called when the proxy has been changed. 8704 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 8705 * <br>2. Incorrect parameter types. 8706 * @syscap SystemCapability.Web.Webview.Core 8707 * @since 15 8708 */ 8709 static applyProxyOverride(proxyConfig: ProxyConfig, callback: OnProxyConfigChangeCallback): void; 8710 /** 8711 * Remove the proxy config. Requests are not guaranteed to not use the proxy; Wait for the listener before loading a page. This listener 8712 * will be called on the UI thread. 8713 * 8714 * @param { OnProxyConfigChangeCallback } callback - Called when the proxy has been changed. 8715 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 8716 * <br>2. Incorrect parameter types. 8717 * @syscap SystemCapability.Web.Webview.Core 8718 * @since 15 8719 */ 8720 static removeProxyOverride(callback: OnProxyConfigChangeCallback): void; 8721} 8722} 8723 8724export default webview; 8725