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 21/*** if arkts 1.2 */ 22import webview from '../../@ohos.web.webview'; 23import { CommonMethod, Callback } from './common'; 24import { CustomBuilder } from './builder' 25import { Resource } from '../../global/resource'; 26/*** endif */ 27 28/** 29 * Provides methods for controlling the web controller. 30 * 31 * @typedef { webview.WebviewController } 32 * @syscap SystemCapability.Web.Webview.Core 33 * @crossplatform 34 * @since 20 35 * @arkts 1.2 36 */ 37type WebviewController = webview.WebviewController; 38 39/** 40 * Provides methods for controlling the web controller. 41 * 42 * @syscap SystemCapability.Web.Webview.Core 43 * @since 9 44 */ 45/** 46 * Provides methods for controlling the web controller. 47 * 48 * @syscap SystemCapability.Web.Webview.Core 49 * @crossplatform 50 * @since 10 51 */ 52/** 53 * Provides methods for controlling the web controller. 54 * 55 * @typedef { import('../api/@ohos.web.webview').default.WebviewController } 56 * @syscap SystemCapability.Web.Webview.Core 57 * @crossplatform 58 * @atomicservice 59 * @since 11 60 */ 61declare type WebviewController = import('../api/@ohos.web.webview').default.WebviewController; 62 63/** 64 * The callback of load committed. 65 * 66 * @typedef { function } OnNavigationEntryCommittedCallback 67 * @param { LoadCommittedDetails } loadCommittedDetails - callback information of onNavigationEntryCommitted. 68 * @syscap SystemCapability.Web.Webview.Core 69 * @atomicservice 70 * @since 11 71 */ 72type OnNavigationEntryCommittedCallback = (loadCommittedDetails: LoadCommittedDetails) => void; 73 74/** 75 * The callback of ssl error event. 76 * 77 * @typedef { function } OnSslErrorEventCallback 78 * @param { SslErrorEvent } sslErrorEvent - callback information of onSslErrorEvent. 79 * @syscap SystemCapability.Web.Webview.Core 80 * @atomicservice 81 * @since 12 82 */ 83type OnSslErrorEventCallback = (sslErrorEvent: SslErrorEvent) => void; 84 85/** 86 * The callback of onOverrideErrorPage. 87 * 88 * @typedef { function } OnOverrideErrorPageCallback 89 * @param { OnErrorReceiveEvent } errorPageEvent - The information of error. 90 * @returns { string } - Return an HTML text content encoded in Base64. 91 * @syscap SystemCapability.Web.Webview.Core 92 * @since 20 93 */ 94type OnOverrideErrorPageCallback = (errorPageEvent: OnErrorReceiveEvent) => string; 95 96/** 97 * The callback of largestContentfulPaint. 98 * 99 * @typedef { function } OnLargestContentfulPaintCallback 100 * @param { LargestContentfulPaint } largestContentfulPaint - callback information of onLargestContentfulPaint. 101 * @syscap SystemCapability.Web.Webview.Core 102 * @atomicservice 103 * @since 12 104 */ 105type OnLargestContentfulPaintCallback = (largestContentfulPaint: LargestContentfulPaint) => void; 106 107/** 108 * The callback of firstMeaningfulPaint. 109 * 110 * @typedef { function } OnFirstMeaningfulPaintCallback 111 * @param { FirstMeaningfulPaint } firstMeaningfulPaint - callback information of onFirstMeaningfulPaint. 112 * @syscap SystemCapability.Web.Webview.Core 113 * @atomicservice 114 * @since 12 115 */ 116type OnFirstMeaningfulPaintCallback = (firstMeaningfulPaint: FirstMeaningfulPaint) => void; 117 118/** 119 * The callback of onOverrideUrlLoading. 120 * Should not call WebviewController.loadUrl with the request's URL and then return true. 121 * 122 * @typedef { function } OnOverrideUrlLoadingCallback 123 * @param { WebResourceRequest } webResourceRequest - callback information of onOverrideUrlLoading. 124 * @returns { boolean } - Returning true causes the current Web to abort loading the URL, 125 * false causes the Web to continue loading the url as usual. 126 * @syscap SystemCapability.Web.Webview.Core 127 * @atomicservice 128 * @since 12 129 */ 130type OnOverrideUrlLoadingCallback = (webResourceRequest: WebResourceRequest) => boolean; 131 132/** 133 * The callback of Intelligent Tracking Prevention. 134 * 135 * @typedef { function } OnIntelligentTrackingPreventionCallback 136 * @param { IntelligentTrackingPreventionDetails } details - callback information of onIntelligentTrackingPrevention. 137 * @syscap SystemCapability.Web.Webview.Core 138 * @atomicservice 139 * @since 12 140 */ 141type OnIntelligentTrackingPreventionCallback = (details: IntelligentTrackingPreventionDetails) => void; 142 143/** 144 * The callback of onNativeEmbedVisibilityChange. 145 * 146 * @typedef { function } OnNativeEmbedVisibilityChangeCallback 147 * @param { NativeEmbedVisibilityInfo } nativeEmbedVisibilityInfo - callback information of onNativeEmbedVisibilityChange. 148 * @syscap SystemCapability.Web.Webview.Core 149 * @since 12 150 */ 151type OnNativeEmbedVisibilityChangeCallback = (nativeEmbedVisibilityInfo: NativeEmbedVisibilityInfo) => void; 152 153/** 154 * The configuration of native media player. 155 * 156 * @typedef NativeMediaPlayerConfig 157 * @syscap SystemCapability.Web.Webview.Core 158 * @atomicservice 159 * @since 12 160 */ 161declare interface NativeMediaPlayerConfig { 162 /** 163 * Whether to enable the application to take over the webpage media playback function. 164 * 165 * @type { boolean } 166 * {@code true} means to enable the application to take over the web media playback function, {@code false} otherwise. 167 * Deflault value: false. 168 * @syscap SystemCapability.Web.Webview.Core 169 * @atomicservice 170 * @since 12 171 */ 172 enable: boolean; 173 174 /** 175 * Whether the video player's display overlays the web page content when the application takes over the web page's video player. 176 * 177 * @type { boolean } 178 * {@code true} means changing the height of the video layer to cover the content of the webpage, {@code false} otherwise. 179 * Deflault value: false. 180 * @syscap SystemCapability.Web.Webview.Core 181 * @atomicservice 182 * @since 12 183 */ 184 shouldOverlay: boolean; 185} 186 187/** 188 * The callback of render process not responding. 189 * 190 * @typedef { function } OnRenderProcessNotRespondingCallback 191 * @param { RenderProcessNotRespondingData } data - details of onRenderProcessNotResponding. 192 * @syscap SystemCapability.Web.Webview.Core 193 * @since 12 194 */ 195type OnRenderProcessNotRespondingCallback = (data : RenderProcessNotRespondingData) => void; 196 197/** 198 * The callback of render process responding. 199 * 200 * @typedef { function } OnRenderProcessRespondingCallback 201 * @syscap SystemCapability.Web.Webview.Core 202 * @since 12 203 */ 204type OnRenderProcessRespondingCallback = () => void; 205 206/** 207 * The callback of ViewportFit Changed. 208 * 209 * @typedef { function } OnViewportFitChangedCallback 210 * @param { ViewportFit } viewportFit - details of OnViewportFitChangedCallback. 211 * @syscap SystemCapability.Web.Webview.Core 212 * @atomicservice 213 * @since 12 214 */ 215type OnViewportFitChangedCallback = (viewportFit: ViewportFit) => void; 216 217/** 218 * The callback of ads block 219 * 220 * @typedef { function } OnAdsBlockedCallback 221 * @param { AdsBlockedDetails } details - details of OnAdsBlockedCallback. 222 * @syscap SystemCapability.Web.Webview.Core 223 * @atomicservice 224 * @since 12 225 */ 226type OnAdsBlockedCallback = (details: AdsBlockedDetails) => void; 227 228/** 229 * Defines the ads block details. 230 * 231 * @interface AdsBlockedDetails 232 * @syscap SystemCapability.Web.Webview.Core 233 * @atomicservice 234 * @since 12 235 */ 236declare interface AdsBlockedDetails { 237 /** 238 * The url of main frame. 239 * 240 * @type { string } 241 * @syscap SystemCapability.Web.Webview.Core 242 * @atomicservice 243 * @since 12 244 */ 245 url: string; 246 247 /** 248 * the url of ads. 249 * 250 * @type { Array<string> } 251 * @syscap SystemCapability.Web.Webview.Core 252 * @atomicservice 253 * @since 12 254 */ 255 adsBlocked: Array<string>; 256} 257 258/** 259 * Defines the web keyboard options when onInterceptKeyboardAttach event return. 260 * 261 * @interface WebKeyboardOptions 262 * @syscap SystemCapability.Web.Webview.Core 263 * @atomicservice 264 * @since arkts {'1.1':'12', '1.2':'20'} 265 * @arkts 1.1&1.2 266 */ 267declare interface WebKeyboardOptions { 268 /** 269 * Whether the system keyboard is used. 270 * 271 * @type { boolean } 272 * @syscap SystemCapability.Web.Webview.Core 273 * @atomicservice 274 * @since arkts {'1.1':'12', '1.2':'20'} 275 * @arkts 1.1&1.2 276 */ 277 useSystemKeyboard: boolean; 278 279 /** 280 * Set the enter key type when the system keyboard is used, the "enter" key related to the {@link inputMethodEngine}. 281 * 282 * @type { ?number } 283 * @syscap SystemCapability.Web.Webview.Core 284 * @atomicservice 285 * @since 12 286 */ 287 enterKeyType?: number; 288 289 /** 290 * Set the custom keyboard builder when the custom keyboard is used. 291 * 292 * @type { ?CustomBuilder } 293 * @syscap SystemCapability.Web.Webview.Core 294 * @atomicservice 295 * @since arkts {'1.1':'12', '1.2':'20'} 296 * @arkts 1.1&1.2 297 */ 298 customKeyboard?: CustomBuilder; 299} 300 301/** 302 * Define the controller to interact with a custom keyboard, related to the {@link onInterceptKeyboardAttach} event. 303 * 304 * @syscap SystemCapability.Web.Webview.Core 305 * @atomicservice 306 * @since arkts {'1.1':'12', '1.2':'20'} 307 * @arkts 1.1&1.2 308 */ 309declare class WebKeyboardController { 310 /** 311 * Constructor. 312 * 313 * @syscap SystemCapability.Web.Webview.Core 314 * @atomicservice 315 * @since arkts {'1.1':'12', '1.2':'20'} 316 * @arkts 1.1&1.2 317 */ 318 constructor(); 319 320 /** 321 * Insert characters in the Web input field. 322 * 323 * @param { string } text - text which will be inserted. 324 * @syscap SystemCapability.Web.Webview.Core 325 * @since arkts {'1.1':'12', '1.2':'20'} 326 * @arkts 1.1&1.2 327 */ 328 insertText(text: string): void; 329 330 /** 331 * Deletes the specified length of characters from the back to the front in the Web input field. 332 * 333 * @param { number } length - length of text, which will be deleted from back to front. 334 * @syscap SystemCapability.Web.Webview.Core 335 * @since arkts {'1.1':'12', '1.2':'20'} 336 * @arkts 1.1&1.2 337 */ 338 deleteForward(length: number): void; 339 340 /** 341 * Delete the specified length of characters in the Web input field from the beginning to the end. 342 * 343 * @param { number } length - length of text, which will be deleted from front to back. 344 * @syscap SystemCapability.Web.Webview.Core 345 * @since arkts {'1.1':'12', '1.2':'20'} 346 * @arkts 1.1&1.2 347 */ 348 deleteBackward(length: number): void; 349 350 /** 351 * Send the function of the key. 352 * 353 * @param { number } key - action indicates the "enter" key related to the {@link inputMethodEngine} 354 * @syscap SystemCapability.Web.Webview.Core 355 * @since 12 356 */ 357 sendFunctionKey(key: number): void; 358 359 /** 360 * Close the custom keyboard. 361 * 362 * @syscap SystemCapability.Web.Webview.Core 363 * @since 12 364 */ 365 close(): void; 366} 367 368/** 369 * Defines the web keyboard callback info related to the {@link onInterceptKeyboardAttach} event. 370 * 371 * @interface WebKeyboardCallbackInfo 372 * @syscap SystemCapability.Web.Webview.Core 373 * @atomicservice 374 * @since arkts {'1.1':'12', '1.2':'20'} 375 * @arkts 1.1&1.2 376 */ 377declare interface WebKeyboardCallbackInfo { 378 /** 379 * The web keyboard controller. 380 * 381 * @type { WebKeyboardController } 382 * @syscap SystemCapability.Web.Webview.Core 383 * @atomicservice 384 * @since arkts {'1.1':'12', '1.2':'20'} 385 * @arkts 1.1&1.2 386 */ 387 controller: WebKeyboardController; 388 389 /** 390 * The attributes of web input element. 391 * 392 * @type { Record<string, string> } 393 * @syscap SystemCapability.Web.Webview.Core 394 * @atomicservice 395 * @since 12 396 */ 397 attributes: Record<string, string>; 398} 399 400/** 401 * The callback of onInterceptKeyboardAttach event. 402 * 403 * @typedef { function } WebKeyboardCallback 404 * @param { WebKeyboardCallbackInfo } keyboardCallbackInfo - callback information of onInterceptKeyboardAttach. 405 * @returns { WebKeyboardOptions } Return the web keyboard options of this web component. 406 * @syscap SystemCapability.Web.Webview.Core 407 * @atomicservice 408 * @since arkts {'1.1':'12', '1.2':'20'} 409 * @arkts 1.1&1.2 410 */ 411type WebKeyboardCallback = (keyboardCallbackInfo: WebKeyboardCallbackInfo) => WebKeyboardOptions; 412 413/** 414 * Enum type supplied to {@link getMessageLevel} for receiving the console log level of JavaScript. 415 * 416 * @enum { number } 417 * @syscap SystemCapability.Web.Webview.Core 418 * @since 8 419 */ 420/** 421 * Enum type supplied to {@link getMessageLevel} for receiving the console log level of JavaScript. 422 * 423 * @enum { number } 424 * @syscap SystemCapability.Web.Webview.Core 425 * @crossplatform 426 * @atomicservice 427 * @since 11 428 */ 429declare enum MessageLevel { 430 /** 431 * Debug level. 432 * 433 * @syscap SystemCapability.Web.Webview.Core 434 * @since 8 435 */ 436 /** 437 * Debug level. 438 * 439 * @syscap SystemCapability.Web.Webview.Core 440 * @crossplatform 441 * @atomicservice 442 * @since 11 443 */ 444 Debug, 445 446 /** 447 * Error level. 448 * 449 * @syscap SystemCapability.Web.Webview.Core 450 * @since 8 451 */ 452 /** 453 * Error level. 454 * 455 * @syscap SystemCapability.Web.Webview.Core 456 * @crossplatform 457 * @atomicservice 458 * @since 11 459 */ 460 Error, 461 462 /** 463 * Info level. 464 * 465 * @syscap SystemCapability.Web.Webview.Core 466 * @since 8 467 */ 468 /** 469 * Info level. 470 * 471 * @syscap SystemCapability.Web.Webview.Core 472 * @crossplatform 473 * @atomicservice 474 * @since 11 475 */ 476 Info, 477 478 /** 479 * Log level. 480 * 481 * @syscap SystemCapability.Web.Webview.Core 482 * @since 8 483 */ 484 /** 485 * Log level. 486 * 487 * @syscap SystemCapability.Web.Webview.Core 488 * @crossplatform 489 * @atomicservice 490 * @since 11 491 */ 492 Log, 493 494 /** 495 * Warn level. 496 * 497 * @syscap SystemCapability.Web.Webview.Core 498 * @since 8 499 */ 500 /** 501 * Warn level. 502 * 503 * @syscap SystemCapability.Web.Webview.Core 504 * @crossplatform 505 * @atomicservice 506 * @since 11 507 */ 508 Warn 509} 510 511/** 512 * The Web's behavior to load from HTTP or HTTPS. Defaults to MixedMode.None. 513 * 514 * @enum { number } 515 * @syscap SystemCapability.Web.Webview.Core 516 * @since 8 517 */ 518/** 519 * The Web's behavior to load from HTTP or HTTPS. Defaults to MixedMode.None. 520 * 521 * @enum { number } 522 * @syscap SystemCapability.Web.Webview.Core 523 * @atomicservice 524 * @since 11 525 */ 526/** 527 * The Web's behavior to load from HTTP or HTTPS. Defaults to MixedMode.None. 528 * 529 * @enum { number } 530 * @syscap SystemCapability.Web.Webview.Core 531 * @crossplatform 532 * @atomicservice 533 * @since 18 534 */ 535declare enum MixedMode { 536 /** 537 * Allows all sources. 538 * 539 * @syscap SystemCapability.Web.Webview.Core 540 * @since 8 541 */ 542 /** 543 * Allows all sources. 544 * 545 * @syscap SystemCapability.Web.Webview.Core 546 * @atomicservice 547 * @since 11 548 */ 549 /** 550 * Loose Mode: HTTP and HTTPS hybrid content can be loaded. This means that all insecure content can be loaded. 551 * 552 * @syscap SystemCapability.Web.Webview.Core 553 * @crossplatform 554 * @atomicservice 555 * @since 18 556 */ 557 All = 0, 558 559 /** 560 * Allows sources Compatibly. 561 * 562 * @syscap SystemCapability.Web.Webview.Core 563 * @since 8 564 */ 565 /** 566 * Allows sources Compatibly. 567 * 568 * @syscap SystemCapability.Web.Webview.Core 569 * @atomicservice 570 * @since 11 571 */ 572 /** 573 * Compatibility Modes: HTTP and HTTPS hybrid content can be loaded in compatibility mode. This means that some insecure content may be loaded. 574 * 575 * @syscap SystemCapability.Web.Webview.Core 576 * @crossplatform 577 * @atomicservice 578 * @since 18 579 */ 580 Compatible = 1, 581 582 /** 583 * Don't allow unsecure sources from a secure origin. 584 * 585 * @syscap SystemCapability.Web.Webview.Core 586 * @since 8 587 */ 588 /** 589 * Don't allow unsecure sources from a secure origin. 590 * 591 * @syscap SystemCapability.Web.Webview.Core 592 * @atomicservice 593 * @since 11 594 */ 595 /** 596 * Strict Mode: HTTP and HTTPS hybrid content cannot be loaded. 597 * 598 * @syscap SystemCapability.Web.Webview.Core 599 * @crossplatform 600 * @atomicservice 601 * @since 18 602 */ 603 None = 2 604} 605 606/** 607 * The callback of safe browsing check. 608 * 609 * @typedef { function } OnSafeBrowsingCheckResultCallback 610 * @param { ThreatType } threatType - callback information of onSafeBrowsingCheckResult. 611 * @syscap SystemCapability.Web.Webview.Core 612 * @atomicservice 613 * @since 11 614 */ 615type OnSafeBrowsingCheckResultCallback = (threatType: ThreatType) => void; 616 617/** 618 * Enum type supplied to {@link getHitTest} for indicating the cursor node HitTest. 619 * 620 * @enum { number } 621 * @syscap SystemCapability.Web.Webview.Core 622 * @since 8 623 */ 624/** 625 * Enum type supplied to {@link getHitTest} for indicating the cursor node HitTest. 626 * 627 * @enum { number } 628 * @syscap SystemCapability.Web.Webview.Core 629 * @atomicservice 630 * @since 11 631 */ 632declare enum HitTestType { 633 /** 634 * The edit text. 635 * 636 * @syscap SystemCapability.Web.Webview.Core 637 * @since 8 638 */ 639 /** 640 * The edit text. 641 * 642 * @syscap SystemCapability.Web.Webview.Core 643 * @atomicservice 644 * @since 11 645 */ 646 EditText = 0, 647 648 /** 649 * The email address. 650 * 651 * @syscap SystemCapability.Web.Webview.Core 652 * @since 8 653 */ 654 /** 655 * The email address. 656 * 657 * @syscap SystemCapability.Web.Webview.Core 658 * @atomicservice 659 * @since 11 660 */ 661 Email = 1, 662 663 /** 664 * The HTML::a tag with src=http. 665 * 666 * @syscap SystemCapability.Web.Webview.Core 667 * @since 8 668 */ 669 /** 670 * The HTML::a tag with src=http. 671 * 672 * @syscap SystemCapability.Web.Webview.Core 673 * @atomicservice 674 * @since 11 675 */ 676 HttpAnchor = 2, 677 678 /** 679 * The HTML::a tag with src=http + HTML::img. 680 * 681 * @syscap SystemCapability.Web.Webview.Core 682 * @since 8 683 */ 684 /** 685 * The HTML::a tag with src=http + HTML::img. 686 * 687 * @syscap SystemCapability.Web.Webview.Core 688 * @atomicservice 689 * @since 11 690 */ 691 HttpAnchorImg = 3, 692 693 /** 694 * The HTML::img tag. 695 * 696 * @syscap SystemCapability.Web.Webview.Core 697 * @since 8 698 */ 699 /** 700 * The HTML::img tag. 701 * 702 * @syscap SystemCapability.Web.Webview.Core 703 * @atomicservice 704 * @since 11 705 */ 706 Img = 4, 707 708 /** 709 * The map address. 710 * 711 * @syscap SystemCapability.Web.Webview.Core 712 * @since 8 713 */ 714 /** 715 * The map address. 716 * 717 * @syscap SystemCapability.Web.Webview.Core 718 * @atomicservice 719 * @since 11 720 */ 721 Map = 5, 722 723 /** 724 * The phone number. 725 * 726 * @syscap SystemCapability.Web.Webview.Core 727 * @since 8 728 */ 729 /** 730 * The phone number. 731 * 732 * @syscap SystemCapability.Web.Webview.Core 733 * @atomicservice 734 * @since 11 735 */ 736 Phone = 6, 737 738 /** 739 * Other unknown HitTest. 740 * 741 * @syscap SystemCapability.Web.Webview.Core 742 * @since 8 743 */ 744 /** 745 * Other unknown HitTest. 746 * 747 * @syscap SystemCapability.Web.Webview.Core 748 * @atomicservice 749 * @since 11 750 */ 751 Unknown = 7 752} 753 754/** 755 * Enum type supplied to {@link cacheMode} for setting the Web cache mode. 756 * 757 * @enum { number } 758 * @syscap SystemCapability.Web.Webview.Core 759 * @since 8 760 */ 761/** 762 * Enum type supplied to {@link cacheMode} for setting the Web cache mode. 763 * 764 * @enum { number } 765 * @syscap SystemCapability.Web.Webview.Core 766 * @atomicservice 767 * @since 11 768 */ 769/** 770 * Enum type supplied to {@link cacheMode} for setting the Web cache mode. 771 * 772 * @enum { number } 773 * @syscap SystemCapability.Web.Webview.Core 774 * @crossplatform 775 * @atomicservice 776 * @since 18 777 */ 778declare enum CacheMode { 779 /** 780 * load cache when they are available and not expired, otherwise load online. 781 * 782 * @syscap SystemCapability.Web.Webview.Core 783 * @since 9 784 */ 785 /** 786 * load cache when they are available and not expired, otherwise load online. 787 * 788 * @syscap SystemCapability.Web.Webview.Core 789 * @atomicservice 790 * @since 11 791 */ 792 /** 793 * load cache when they are available and not expired, otherwise load online. 794 * 795 * @syscap SystemCapability.Web.Webview.Core 796 * @crossplatform 797 * @atomicservice 798 * @since 18 799 */ 800 Default = 0, 801 802 /** 803 * load cache when they are available, otherwise load online. 804 * 805 * @syscap SystemCapability.Web.Webview.Core 806 * @since 8 807 */ 808 /** 809 * load cache when they are available, otherwise load online. 810 * 811 * @syscap SystemCapability.Web.Webview.Core 812 * @atomicservice 813 * @since 11 814 */ 815 /** 816 * load cache when they are available, otherwise load online. 817 * 818 * @syscap SystemCapability.Web.Webview.Core 819 * @crossplatform 820 * @atomicservice 821 * @since 18 822 */ 823 None = 1, 824 825 /** 826 * Load online and not cache. 827 * 828 * @syscap SystemCapability.Web.Webview.Core 829 * @since 8 830 */ 831 /** 832 * Load online and not cache. 833 * 834 * @syscap SystemCapability.Web.Webview.Core 835 * @atomicservice 836 * @since 11 837 */ 838 /** 839 * Load online and not cache. 840 * 841 * @syscap SystemCapability.Web.Webview.Core 842 * @crossplatform 843 * @atomicservice 844 * @since 18 845 */ 846 Online = 2, 847 848 /** 849 * load cache and not online. 850 * 851 * @syscap SystemCapability.Web.Webview.Core 852 * @since 8 853 */ 854 /** 855 * load cache and not online. 856 * 857 * @syscap SystemCapability.Web.Webview.Core 858 * @atomicservice 859 * @since 11 860 */ 861 /** 862 * load cache and not online. 863 * 864 * @syscap SystemCapability.Web.Webview.Core 865 * @crossplatform 866 * @atomicservice 867 * @since 18 868 */ 869 Only = 3 870} 871 872/** 873 * Enum type supplied to {@link overScrollMode} for setting the web overScroll mode. 874 * 875 * @enum { number } 876 * @syscap SystemCapability.Web.Webview.Core 877 * @atomicservice 878 * @since 11 879 */ 880declare enum OverScrollMode { 881 /** 882 * Disable the web over-scroll mode. 883 * 884 * @syscap SystemCapability.Web.Webview.Core 885 * @atomicservice 886 * @since 11 887 */ 888 NEVER = 0, 889 890 /** 891 * Enable the web over-scroll mode. 892 * 893 * @syscap SystemCapability.Web.Webview.Core 894 * @atomicservice 895 * @since 11 896 */ 897 ALWAYS = 1 898} 899 900/** 901 * Enum type supplied to {@link blurOnKeyboardHideMode} for setting the web blurOnKeyboardHide mode. 902 * 903 * @enum { number } 904 * @syscap SystemCapability.Web.Webview.Core 905 * @atomicservice 906 * @since 14 907 */ 908declare enum BlurOnKeyboardHideMode { 909 /** 910 * The focused input elements on webview will not blur when soft keyboard is hidden manually. 911 * 912 * @syscap SystemCapability.Web.Webview.Core 913 * @atomicservice 914 * @since 14 915 */ 916 SILENT = 0, 917 918 /** 919 * The focused input elements on webview will blur when soft keyboard is hidden manually. 920 * 921 * @syscap SystemCapability.Web.Webview.Core 922 * @atomicservice 923 * @since 14 924 */ 925 BLUR = 1 926} 927 928/** 929 * Enum type supplied to {@link darkMode} for setting the web dark mode. 930 * 931 * @enum { number } 932 * @syscap SystemCapability.Web.Webview.Core 933 * @since 9 934 */ 935/** 936 * Enum type supplied to {@link darkMode} for setting the web dark mode. 937 * 938 * @enum { number } 939 * @syscap SystemCapability.Web.Webview.Core 940 * @atomicservice 941 * @since 11 942 */ 943declare enum WebDarkMode { 944 /** 945 * Disable the web dark mode. 946 * 947 * @syscap SystemCapability.Web.Webview.Core 948 * @since 9 949 */ 950 /** 951 * Disable the web dark mode. 952 * 953 * @syscap SystemCapability.Web.Webview.Core 954 * @atomicservice 955 * @since 11 956 */ 957 Off = 0, 958 959 /** 960 * Enable the web dark mode. 961 * 962 * @syscap SystemCapability.Web.Webview.Core 963 * @since 9 964 */ 965 /** 966 * Enable the web dark mode. 967 * 968 * @syscap SystemCapability.Web.Webview.Core 969 * @atomicservice 970 * @since 11 971 */ 972 On = 1, 973 974 /** 975 * Make web dark mode follow the system. 976 * 977 * @syscap SystemCapability.Web.Webview.Core 978 * @since 9 979 */ 980 /** 981 * Make web dark mode follow the system. 982 * 983 * @syscap SystemCapability.Web.Webview.Core 984 * @atomicservice 985 * @since 11 986 */ 987 Auto = 2 988} 989 990/** 991 * Enum type supplied to {@link captureMode} for setting the web capture mode. 992 * 993 * @enum { number } 994 * @syscap SystemCapability.Web.Webview.Core 995 * @since 10 996 */ 997/** 998 * Enum type supplied to {@link captureMode} for setting the web capture mode. 999 * 1000 * @enum { number } 1001 * @syscap SystemCapability.Web.Webview.Core 1002 * @atomicservice 1003 * @since 11 1004 */ 1005declare enum WebCaptureMode { 1006 /** 1007 * The home screen. 1008 * @syscap SystemCapability.Web.Webview.Core 1009 * @since 10 1010 */ 1011 /** 1012 * Capture of the home screen. 1013 * @syscap SystemCapability.Web.Webview.Core 1014 * @atomicservice 1015 * @since 11 1016 */ 1017 HOME_SCREEN = 0 1018} 1019 1020/** 1021 * Enum type supplied to {@link threatType} for the website's threat type. 1022 * 1023 * @enum { number } 1024 * @syscap SystemCapability.Web.Webview.Core 1025 * @atomicservice 1026 * @since 11 1027 */ 1028declare enum ThreatType { 1029 /** 1030 * Illegal websites. 1031 * 1032 * @syscap SystemCapability.Web.Webview.Core 1033 * @atomicservice 1034 * @since 11 1035 */ 1036 THREAT_ILLEGAL = 0, 1037 1038 /** 1039 * Fraud websites. 1040 * 1041 * @syscap SystemCapability.Web.Webview.Core 1042 * @atomicservice 1043 * @since 11 1044 */ 1045 THREAT_FRAUD = 1, 1046 1047 /** 1048 * Websites with security risks. 1049 * 1050 * @syscap SystemCapability.Web.Webview.Core 1051 * @atomicservice 1052 * @since 11 1053 */ 1054 THREAT_RISK = 2, 1055 1056 /** 1057 * Websites suspected of containing unhealthy content. 1058 * ArkWeb will not intercept this type of website and apps could handle it themselves. 1059 * 1060 * @syscap SystemCapability.Web.Webview.Core 1061 * @atomicservice 1062 * @since 11 1063 */ 1064 THREAT_WARNING = 3 1065} 1066 1067/** 1068 * Defines the Media Options. 1069 * 1070 * @interface WebMediaOptions 1071 * @syscap SystemCapability.Web.Webview.Core 1072 * @since 10 1073 */ 1074/** 1075 * Defines the Media Options. 1076 * 1077 * @interface WebMediaOptions 1078 * @syscap SystemCapability.Web.Webview.Core 1079 * @atomicservice 1080 * @since 11 1081 */ 1082/** 1083 * Defines the Media Options. 1084 * 1085 * @typedef WebMediaOptions 1086 * @syscap SystemCapability.Web.Webview.Core 1087 * @atomicservice 1088 * @since 12 1089 */ 1090declare interface WebMediaOptions { 1091 /** 1092 * The time interval for audio playback to resume. 1093 * 1094 * @type { ?number } 1095 * @syscap SystemCapability.Web.Webview.Core 1096 * @since 10 1097 */ 1098 /** 1099 * Validity period for automatically resuming a paused web audio, in seconds. 1100 * The maximum validity period is 60 seconds. Due to the approximate value, 1101 * the validity period may have a deviation of less than 1 second. 1102 * 1103 * @type { ?number } 1104 * @syscap SystemCapability.Web.Webview.Core 1105 * @atomicservice 1106 * @since 11 1107 */ 1108 resumeInterval?: number; 1109 1110 /** 1111 * Whether the audio of each web is exclusive. 1112 * 1113 * @type { ?boolean } 1114 * @syscap SystemCapability.Web.Webview.Core 1115 * @since 10 1116 */ 1117 /** 1118 * Whether the audio of multiple Web instances in an application is exclusive. 1119 * 1120 * @type { ?boolean } 1121 * {@code true} means audio exclusivity for multiple web instances within the application, {@code false} otherwise. 1122 * @syscap SystemCapability.Web.Webview.Core 1123 * @atomicservice 1124 * @since 11 1125 */ 1126 audioExclusive?: boolean; 1127 1128 /** 1129 * The type for audio sessions. 1130 * 1131 * @type { ?AudioSessionType } 1132 * @syscap SystemCapability.Web.Webview.Core 1133 * @since 20 1134 */ 1135 audioSessionType?: AudioSessionType; 1136} 1137 1138/** 1139 * Defines the screen capture configuration. 1140 * 1141 * @interface ScreenCaptureConfig 1142 * @syscap SystemCapability.Web.Webview.Core 1143 * @since 10 1144 */ 1145/** 1146 * Defines the screen capture configuration. 1147 * 1148 * @interface ScreenCaptureConfig 1149 * @syscap SystemCapability.Web.Webview.Core 1150 * @atomicservice 1151 * @since 11 1152 */ 1153/** 1154 * Defines the screen capture configuration. 1155 * 1156 * @typedef ScreenCaptureConfig 1157 * @syscap SystemCapability.Web.Webview.Core 1158 * @atomicservice 1159 * @since arkts {'1.1':'12', '1.2':'20'} 1160 * @arkts 1.1&1.2 1161 */ 1162declare interface ScreenCaptureConfig { 1163 /** 1164 * The mode for selecting the recording area. 1165 * 1166 * @type { WebCaptureMode } 1167 * @syscap SystemCapability.Web.Webview.Core 1168 * @since 10 1169 */ 1170 /** 1171 * The mode for selecting the recording area. 1172 * 1173 * @type { WebCaptureMode } 1174 * @syscap SystemCapability.Web.Webview.Core 1175 * @atomicservice 1176 * @since 11 1177 */ 1178 captureMode: WebCaptureMode; 1179} 1180 1181/** 1182 * Define the handler to exit the full screen mode, related to the {@link onFullScreenEnter} event. 1183 * 1184 * @syscap SystemCapability.Web.Webview.Core 1185 * @since 9 1186 */ 1187/** 1188 * Define the handler to exit the full screen mode, related to the {@link onFullScreenEnter} event. 1189 * 1190 * @syscap SystemCapability.Web.Webview.Core 1191 * @atomicservice 1192 * @since 11 1193 */ 1194/** 1195 * Define the handler to exit the full screen mode, related to the {@link onFullScreenEnter} event. 1196 * 1197 * @syscap SystemCapability.Web.Webview.Core 1198 * @crossplatform 1199 * @atomicservice 1200 * @since 18 1201 */ 1202declare class FullScreenExitHandler { 1203 /** 1204 * Constructor. 1205 * 1206 * @syscap SystemCapability.Web.Webview.Core 1207 * @since 9 1208 */ 1209 /** 1210 * Constructor. 1211 * 1212 * @syscap SystemCapability.Web.Webview.Core 1213 * @atomicservice 1214 * @since 11 1215 */ 1216 /** 1217 * Constructor. 1218 * 1219 * @syscap SystemCapability.Web.Webview.Core 1220 * @crossplatform 1221 * @atomicservice 1222 * @since 18 1223 */ 1224 constructor(); 1225 1226 /** 1227 * Exit the full screen mode. 1228 * 1229 * @syscap SystemCapability.Web.Webview.Core 1230 * @since 9 1231 */ 1232 /** 1233 * Exit the full screen mode. 1234 * 1235 * @syscap SystemCapability.Web.Webview.Core 1236 * @atomicservice 1237 * @since 11 1238 */ 1239 /** 1240 * Called when the Web component exits full screen mode. 1241 * 1242 * @syscap SystemCapability.Web.Webview.Core 1243 * @crossplatform 1244 * @atomicservice 1245 * @since 18 1246 */ 1247 exitFullScreen(): void; 1248} 1249 1250/** 1251 * Defines the event details when the web component enter full screen mode. 1252 * 1253 * @typedef FullScreenEnterEvent 1254 * @syscap SystemCapability.Web.Webview.Core 1255 * @atomicservice 1256 * @since 12 1257 */ 1258/** 1259 * Defines the event details when the web component enter full screen mode. 1260 * 1261 * @typedef FullScreenEnterEvent 1262 * @syscap SystemCapability.Web.Webview.Core 1263 * @crossplatform 1264 * @atomicservice 1265 * @since 18 1266 */ 1267declare interface FullScreenEnterEvent { 1268 /** 1269 * A function handle to exit full-screen mode. 1270 * 1271 * @type { FullScreenExitHandler } 1272 * @syscap SystemCapability.Web.Webview.Core 1273 * @atomicservice 1274 * @since 12 1275 */ 1276 /** 1277 * A function handle to exit full-screen mode. 1278 * 1279 * @type { FullScreenExitHandler } 1280 * @syscap SystemCapability.Web.Webview.Core 1281 * @crossplatform 1282 * @atomicservice 1283 * @since 18 1284 */ 1285 handler: FullScreenExitHandler; 1286 1287 /** 1288 * The intrinsic width of the video if the fullscreen element contains video element, expressed in CSS pixels. 1289 * 1290 * @type { ?number } 1291 * @syscap SystemCapability.Web.Webview.Core 1292 * @atomicservice 1293 * @since 12 1294 */ 1295 /** 1296 * The intrinsic width of the video if the fullscreen element contains video element, expressed in CSS pixels. 1297 * 1298 * @type { ?number } 1299 * @syscap SystemCapability.Web.Webview.Core 1300 * @crossplatform 1301 * @atomicservice 1302 * @since 18 1303 */ 1304 videoWidth?: number; 1305 1306 /** 1307 * The intrinsic height of the video if the fullscreen element contains video element, expressed in CSS pixels. 1308 * 1309 * @type { ?number } 1310 * @syscap SystemCapability.Web.Webview.Core 1311 * @atomicservice 1312 * @since 12 1313 */ 1314 /** 1315 * The intrinsic height of the video if the fullscreen element contains video element, expressed in CSS pixels. 1316 * 1317 * @type { ?number } 1318 * @syscap SystemCapability.Web.Webview.Core 1319 * @crossplatform 1320 * @atomicservice 1321 * @since 18 1322 */ 1323 videoHeight?: number; 1324} 1325 1326/** 1327 * The callback when the web component enter full screen mode. 1328 * 1329 * @typedef { function } OnFullScreenEnterCallback 1330 * @param { FullScreenEnterEvent } event - callback information of onFullScreenEnter. 1331 * @syscap SystemCapability.Web.Webview.Core 1332 * @atomicservice 1333 * @since 12 1334 */ 1335/** 1336 * The callback when the web component enter full screen mode. 1337 * 1338 * @typedef { function } OnFullScreenEnterCallback 1339 * @param { FullScreenEnterEvent } event - callback information of onFullScreenEnter. 1340 * @syscap SystemCapability.Web.Webview.Core 1341 * @crossplatform 1342 * @atomicservice 1343 * @since 18 1344 */ 1345type OnFullScreenEnterCallback = (event: FullScreenEnterEvent) => void; 1346 1347 1348/** 1349 * The callback when mouse event is triggered in native embed area 1350 * 1351 * @typedef { function } MouseInfoCallback 1352 * @param { NativeEmbedMouseInfo } event - callback information of mouse event in native embed area. 1353 * @syscap SystemCapability.Web.Webview.Core 1354 * @since 20 1355 */ 1356type MouseInfoCallback = (event: NativeEmbedMouseInfo) => void; 1357 1358/** 1359 * Enum type supplied to {@link renderExitReason} when onRenderExited being called. 1360 * 1361 * @enum { number } 1362 * @syscap SystemCapability.Web.Webview.Core 1363 * @since 9 1364 */ 1365/** 1366 * Enum type supplied to {@link renderExitReason} when onRenderExited being called. 1367 * 1368 * @enum { number } 1369 * @syscap SystemCapability.Web.Webview.Core 1370 * @atomicservice 1371 * @since 11 1372 */ 1373declare enum RenderExitReason { 1374 /** 1375 * Render process non-zero exit status. 1376 * 1377 * @syscap SystemCapability.Web.Webview.Core 1378 * @since 9 1379 */ 1380 /** 1381 * Render process non-zero exit status. 1382 * 1383 * @syscap SystemCapability.Web.Webview.Core 1384 * @atomicservice 1385 * @since 11 1386 */ 1387 ProcessAbnormalTermination = 0, 1388 1389 /** 1390 * SIGKILL or task manager kill. 1391 * 1392 * @syscap SystemCapability.Web.Webview.Core 1393 * @since 9 1394 */ 1395 /** 1396 * SIGKILL or task manager kill. 1397 * 1398 * @syscap SystemCapability.Web.Webview.Core 1399 * @atomicservice 1400 * @since 11 1401 */ 1402 ProcessWasKilled = 1, 1403 1404 /** 1405 * Segmentation fault. 1406 * 1407 * @syscap SystemCapability.Web.Webview.Core 1408 * @since 9 1409 */ 1410 /** 1411 * The rendering process crashes and exits, such as a segment error. 1412 * 1413 * @syscap SystemCapability.Web.Webview.Core 1414 * @atomicservice 1415 * @since 11 1416 */ 1417 ProcessCrashed = 2, 1418 1419 /** 1420 * Out of memory. 1421 * 1422 * @syscap SystemCapability.Web.Webview.Core 1423 * @since 9 1424 */ 1425 /** 1426 * Out of memory. 1427 * 1428 * @syscap SystemCapability.Web.Webview.Core 1429 * @atomicservice 1430 * @since 11 1431 */ 1432 ProcessOom = 3, 1433 1434 /** 1435 * Unknown reason. 1436 * 1437 * @syscap SystemCapability.Web.Webview.Core 1438 * @since 9 1439 */ 1440 /** 1441 * Unknown reason. 1442 * 1443 * @syscap SystemCapability.Web.Webview.Core 1444 * @atomicservice 1445 * @since 11 1446 */ 1447 ProcessExitUnknown = 4 1448} 1449 1450/** 1451 * The callback of custom hide of the context menu. 1452 * 1453 * @typedef { function } OnContextMenuHideCallback 1454 * @syscap SystemCapability.Web.Webview.Core 1455 * @atomicservice 1456 * @since 11 1457 */ 1458type OnContextMenuHideCallback = () => void; 1459 1460/** 1461 * Enum type supplied to {@link error} when onSslErrorEventReceive being called. 1462 * 1463 * @enum { number } 1464 * @syscap SystemCapability.Web.Webview.Core 1465 * @since 9 1466 */ 1467/** 1468 * Enum type supplied to {@link error} when onSslErrorEventReceive being called. 1469 * 1470 * @enum { number } 1471 * @syscap SystemCapability.Web.Webview.Core 1472 * @atomicservice 1473 * @since 11 1474 */ 1475declare enum SslError { 1476 /** 1477 * General error. 1478 * 1479 * @syscap SystemCapability.Web.Webview.Core 1480 * @since 9 1481 */ 1482 /** 1483 * General error. 1484 * 1485 * @syscap SystemCapability.Web.Webview.Core 1486 * @atomicservice 1487 * @since 11 1488 */ 1489 Invalid = 0, 1490 1491 /** 1492 * Hostname mismatch. 1493 * 1494 * @syscap SystemCapability.Web.Webview.Core 1495 * @since 9 1496 */ 1497 /** 1498 * Hostname mismatch. 1499 * 1500 * @syscap SystemCapability.Web.Webview.Core 1501 * @atomicservice 1502 * @since 11 1503 */ 1504 HostMismatch = 1, 1505 1506 /** 1507 * The certificate date is invalid. 1508 * 1509 * @syscap SystemCapability.Web.Webview.Core 1510 * @since 9 1511 */ 1512 /** 1513 * The certificate date is invalid. 1514 * 1515 * @syscap SystemCapability.Web.Webview.Core 1516 * @atomicservice 1517 * @since 11 1518 */ 1519 DateInvalid = 2, 1520 1521 /** 1522 * The certificate authority is not trusted. 1523 * 1524 * @syscap SystemCapability.Web.Webview.Core 1525 * @since 9 1526 */ 1527 /** 1528 * The certificate authority is not trusted. 1529 * 1530 * @syscap SystemCapability.Web.Webview.Core 1531 * @atomicservice 1532 * @since 11 1533 */ 1534 Untrusted = 3 1535} 1536 1537/** 1538 * Enum type supplied to {@link FileSelectorParam} when onFileSelectorShow being called. 1539 * 1540 * @enum { number } 1541 * @syscap SystemCapability.Web.Webview.Core 1542 * @since 9 1543 */ 1544/** 1545 * Enum type supplied to {@link FileSelectorParam} when onFileSelectorShow being called. 1546 * 1547 * @enum { number } 1548 * @syscap SystemCapability.Web.Webview.Core 1549 * @crossplatform 1550 * @atomicservice 1551 * @since arkts {'1.1':'11', '1.2':'20'} 1552 * @arkts 1.1&1.2 1553 */ 1554declare enum FileSelectorMode { 1555 /** 1556 * Allows single file to be selected. 1557 * 1558 * @syscap SystemCapability.Web.Webview.Core 1559 * @since 9 1560 */ 1561 /** 1562 * Allows single file to be selected. 1563 * 1564 * @syscap SystemCapability.Web.Webview.Core 1565 * @crossplatform 1566 * @atomicservice 1567 * @since arkts {'1.1':'11', '1.2':'20'} 1568 * @arkts 1.1&1.2 1569 */ 1570 FileOpenMode = 0, 1571 1572 /** 1573 * Allows multiple files to be selected. 1574 * 1575 * @syscap SystemCapability.Web.Webview.Core 1576 * @since 9 1577 */ 1578 /** 1579 * Allows multiple files to be selected. 1580 * 1581 * @syscap SystemCapability.Web.Webview.Core 1582 * @crossplatform 1583 * @atomicservice 1584 * @since arkts {'1.1':'11', '1.2':'20'} 1585 * @arkts 1.1&1.2 1586 */ 1587 FileOpenMultipleMode = 1, 1588 1589 /** 1590 * Allows file folders to be selected. 1591 * 1592 * @syscap SystemCapability.Web.Webview.Core 1593 * @since 9 1594 */ 1595 /** 1596 * Allows file folders to be selected. 1597 * 1598 * @syscap SystemCapability.Web.Webview.Core 1599 * @crossplatform 1600 * @atomicservice 1601 * @since arkts {'1.1':'11', '1.2':'20'} 1602 * @arkts 1.1&1.2 1603 */ 1604 FileOpenFolderMode = 2, 1605 1606 /** 1607 * Allows select files to save. 1608 * 1609 * @syscap SystemCapability.Web.Webview.Core 1610 * @since 9 1611 */ 1612 /** 1613 * Allows select files to save. 1614 * 1615 * @syscap SystemCapability.Web.Webview.Core 1616 * @crossplatform 1617 * @atomicservice 1618 * @since arkts {'1.1':'11', '1.2':'20'} 1619 * @arkts 1.1&1.2 1620 */ 1621 FileSaveMode = 3 1622} 1623 1624/** 1625 * Enum type supplied to {@link layoutMode} for setting the web layout mode. 1626 * 1627 * @enum { number } 1628 * @syscap SystemCapability.Web.Webview.Core 1629 * @atomicservice 1630 * @since 11 1631 */ 1632declare enum WebLayoutMode { 1633 /** 1634 * Web layout follows the system. 1635 * 1636 * @syscap SystemCapability.Web.Webview.Core 1637 * @atomicservice 1638 * @since 11 1639 */ 1640 NONE = 0, 1641 1642 /** 1643 * Adaptive web layout based on page size. 1644 * 1645 * @syscap SystemCapability.Web.Webview.Core 1646 * @atomicservice 1647 * @since 11 1648 */ 1649 FIT_CONTENT = 1 1650} 1651 1652/** 1653 * Enum type supplied to {@link RenderProcessNotRespondingData} when onRenderProcessNotResponding is called. 1654 * 1655 * @enum { number } 1656 * @syscap SystemCapability.Web.Webview.Core 1657 * @since 12 1658 */ 1659declare enum RenderProcessNotRespondingReason { 1660 /** 1661 * Timeout for input sent to render process. 1662 * 1663 * @syscap SystemCapability.Web.Webview.Core 1664 * @since 12 1665 */ 1666 INPUT_TIMEOUT = 0, 1667 1668 /** 1669 * The new webpage loading navigation response timed out. 1670 * 1671 * @syscap SystemCapability.Web.Webview.Core 1672 * @since 12 1673 */ 1674 NAVIGATION_COMMIT_TIMEOUT = 1 1675} 1676 1677/** 1678 * Encompassed message information as parameters to {@link onFileSelectorShow} method. 1679 * 1680 * @syscap SystemCapability.Web.Webview.Core 1681 * @since 9 1682 */ 1683/** 1684 * Encompassed message information as parameters to {@link onFileSelectorShow} method. 1685 * 1686 * @syscap SystemCapability.Web.Webview.Core 1687 * @crossplatform 1688 * @atomicservice 1689 * @since arkts {'1.1':'11', '1.2':'20'} 1690 * @arkts 1.1&1.2 1691 */ 1692declare class FileSelectorParam { 1693 /** 1694 * Constructor. 1695 * 1696 * @syscap SystemCapability.Web.Webview.Core 1697 * @since 9 1698 */ 1699 /** 1700 * Constructor. 1701 * 1702 * @syscap SystemCapability.Web.Webview.Core 1703 * @crossplatform 1704 * @atomicservice 1705 * @since arkts {'1.1':'11', '1.2':'20'} 1706 * @arkts 1.1&1.2 1707 */ 1708 constructor(); 1709 1710 /** 1711 * Gets the title of this file selector. 1712 * @returns { string } Return the title of this file selector. 1713 * @syscap SystemCapability.Web.Webview.Core 1714 * @since 9 1715 */ 1716 /** 1717 * Gets the title of this file selector. 1718 * @returns { string } Return the title of this file selector. 1719 * @syscap SystemCapability.Web.Webview.Core 1720 * @crossplatform 1721 * @atomicservice 1722 * @since arkts {'1.1':'11', '1.2':'20'} 1723 * @arkts 1.1&1.2 1724 */ 1725 getTitle(): string; 1726 1727 /** 1728 * Gets the FileSelectorMode of this file selector. 1729 * @returns { FileSelectorMode } Return the FileSelectorMode of this file selector. 1730 * @syscap SystemCapability.Web.Webview.Core 1731 * @since 9 1732 */ 1733 /** 1734 * Gets the FileSelectorMode of this file selector. 1735 * @returns { FileSelectorMode } Return the FileSelectorMode of this file selector. 1736 * @syscap SystemCapability.Web.Webview.Core 1737 * @crossplatform 1738 * @atomicservice 1739 * @since arkts {'1.1':'11', '1.2':'20'} 1740 * @arkts 1.1&1.2 1741 */ 1742 getMode(): FileSelectorMode; 1743 1744 /** 1745 * Gets an array of acceptable MIME type. 1746 * @returns { Array<string> } Return an array of acceptable MIME type. 1747 * @syscap SystemCapability.Web.Webview.Core 1748 * @since 9 1749 */ 1750 /** 1751 * Gets an array of acceptable MIME type. 1752 * @returns { Array<string> } Return an array of acceptable MIME type. 1753 * @syscap SystemCapability.Web.Webview.Core 1754 * @crossplatform 1755 * @atomicservice 1756 * @since arkts {'1.1':'11', '1.2':'20'} 1757 * @arkts 1.1&1.2 1758 */ 1759 getAcceptType(): Array<string>; 1760 1761 /** 1762 * Gets whether this file selector use a live media captured value. 1763 * 1764 * @returns { boolean } Return {@code true} if captured media; return {@code false} otherwise. 1765 * @syscap SystemCapability.Web.Webview.Core 1766 * @since 9 1767 */ 1768 /** 1769 * Gets whether this file selector use a live media captured value. 1770 * 1771 * @returns { boolean } Return {@code true} if captured media; return {@code false} otherwise. 1772 * @syscap SystemCapability.Web.Webview.Core 1773 * @crossplatform 1774 * @atomicservice 1775 * @since arkts {'1.1':'11', '1.2':'20'} 1776 * @arkts 1.1&1.2 1777 */ 1778 isCapture(): boolean; 1779 1780 /** 1781 * Gets an array of raw acceptable MIME type. 1782 * @returns { Array<string> } Return an array of raw acceptable MIME type. 1783 * @syscap SystemCapability.Web.Webview.Core 1784 * @since arkts {'1.1':'18', '1.2':'20'} 1785 * @arkts 1.1&1.2 1786 */ 1787 getMimeTypes(): Array<string>; 1788} 1789 1790/** 1791 * Defines the js result. 1792 * 1793 * @syscap SystemCapability.Web.Webview.Core 1794 * @since 8 1795 */ 1796/** 1797 * Defines the js result. 1798 * 1799 * @syscap SystemCapability.Web.Webview.Core 1800 * @crossplatform 1801 * @atomicservice 1802 * @since arkts {'1.1':'11', '1.2':'20'} 1803 * @arkts 1.1&1.2 1804 */ 1805declare class JsResult { 1806 /** 1807 * Constructor. 1808 * 1809 * @syscap SystemCapability.Web.Webview.Core 1810 * @since 8 1811 */ 1812 /** 1813 * Constructor. 1814 * 1815 * @syscap SystemCapability.Web.Webview.Core 1816 * @crossplatform 1817 * @atomicservice 1818 * @since arkts {'1.1':'11', '1.2':'20'} 1819 * @arkts 1.1&1.2 1820 */ 1821 constructor(); 1822 1823 /** 1824 * Handle the user's JavaScript result if cancel the dialog. 1825 * 1826 * @syscap SystemCapability.Web.Webview.Core 1827 * @since 8 1828 */ 1829 /** 1830 * Handle the user's JavaScript result if cancel the dialog. 1831 * 1832 * @syscap SystemCapability.Web.Webview.Core 1833 * @crossplatform 1834 * @atomicservice 1835 * @since arkts {'1.1':'11', '1.2':'20'} 1836 * @arkts 1.1&1.2 1837 */ 1838 handleCancel(): void; 1839 1840 /** 1841 * Handle the user's JavaScript result if confirm the dialog. 1842 * 1843 * @syscap SystemCapability.Web.Webview.Core 1844 * @since 8 1845 */ 1846 /** 1847 * Handle the user's JavaScript result if confirm the dialog. 1848 * 1849 * @syscap SystemCapability.Web.Webview.Core 1850 * @crossplatform 1851 * @atomicservice 1852 * @since arkts {'1.1':'11', '1.2':'20'} 1853 * @arkts 1.1&1.2 1854 */ 1855 handleConfirm(): void; 1856 1857 /** 1858 * Handle the user's JavaScript result if confirm the prompt dialog. 1859 * 1860 * @param { string } result 1861 * @syscap SystemCapability.Web.Webview.Core 1862 * @since 9 1863 */ 1864 /** 1865 * Handle the user's JavaScript result if confirm the prompt dialog. 1866 * 1867 * @param { string } result - The content of the dialog box entered by the user. 1868 * @syscap SystemCapability.Web.Webview.Core 1869 * @crossplatform 1870 * @atomicservice 1871 * @since arkts {'1.1':'11', '1.2':'20'} 1872 * @arkts 1.1&1.2 1873 */ 1874 handlePromptConfirm(result: string): void; 1875} 1876 1877/** 1878 * Defines the file selector result, related to {@link onFileSelectorShow} method. 1879 * 1880 * @syscap SystemCapability.Web.Webview.Core 1881 * @since 9 1882 */ 1883/** 1884 * Defines the file selector result, related to {@link onFileSelectorShow} method. 1885 * 1886 * @syscap SystemCapability.Web.Webview.Core 1887 * @crossplatform 1888 * @atomicservice 1889 * @since arkts {'1.1':'11', '1.2':'20'} 1890 * @arkts 1.1&1.2 1891 */ 1892declare class FileSelectorResult { 1893 /** 1894 * Constructor. 1895 * 1896 * @syscap SystemCapability.Web.Webview.Core 1897 * @since 9 1898 */ 1899 /** 1900 * Constructor. 1901 * 1902 * @syscap SystemCapability.Web.Webview.Core 1903 * @crossplatform 1904 * @atomicservice 1905 * @since arkts {'1.1':'11', '1.2':'20'} 1906 * @arkts 1.1&1.2 1907 */ 1908 constructor(); 1909 1910 /** 1911 * select a list of files. 1912 * 1913 * @param { Array<string> } fileList 1914 * @syscap SystemCapability.Web.Webview.Core 1915 * @since 9 1916 */ 1917 /** 1918 * select a list of files. 1919 * 1920 * @param { Array<string> } fileList - List of files that need to be operated. 1921 * @syscap SystemCapability.Web.Webview.Core 1922 * @crossplatform 1923 * @atomicservice 1924 * @since arkts {'1.1':'11', '1.2':'20'} 1925 * @arkts 1.1&1.2 1926 */ 1927 handleFileList(fileList: Array<string>): void; 1928} 1929 1930/** 1931 * Defines the http auth request result, related to {@link onHttpAuthRequest} method. 1932 * 1933 * @syscap SystemCapability.Web.Webview.Core 1934 * @since 9 1935 */ 1936/** 1937 * Defines the http auth request result, related to {@link onHttpAuthRequest} method. 1938 * 1939 * @syscap SystemCapability.Web.Webview.Core 1940 * @crossplatform 1941 * @atomicservice 1942 * @since arkts {'1.1':'11', '1.2':'20'} 1943 * @arkts 1.1&1.2 1944 */ 1945declare class HttpAuthHandler { 1946 /** 1947 * Constructor. 1948 * 1949 * @syscap SystemCapability.Web.Webview.Core 1950 * @since 9 1951 */ 1952 /** 1953 * Constructor. 1954 * 1955 * @syscap SystemCapability.Web.Webview.Core 1956 * @crossplatform 1957 * @atomicservice 1958 * @since arkts {'1.1':'11', '1.2':'20'} 1959 * @arkts 1.1&1.2 1960 */ 1961 constructor(); 1962 1963 /** 1964 * confirm. 1965 * 1966 * @param { string } userName 1967 * @param { string } password 1968 * @returns { boolean } 1969 * @syscap SystemCapability.Web.Webview.Core 1970 * @since 9 1971 */ 1972 /** 1973 * confirm. 1974 * 1975 * @param { string } userName 1976 * @param { string } password 1977 * @returns { boolean } 1978 * @syscap SystemCapability.Web.Webview.Core 1979 * @crossplatform 1980 * @atomicservice 1981 * @since 11 1982 */ 1983 confirm(userName: string, password: string): boolean; 1984 1985 /** 1986 * cancel. 1987 * 1988 * @syscap SystemCapability.Web.Webview.Core 1989 * @since 9 1990 */ 1991 /** 1992 * cancel. 1993 * 1994 * @syscap SystemCapability.Web.Webview.Core 1995 * @crossplatform 1996 * @atomicservice 1997 * @since 11 1998 */ 1999 cancel(): void; 2000 2001 /** 2002 * isHttpAuthInfoSaved. 2003 * 2004 * @returns { boolean } 2005 * @syscap SystemCapability.Web.Webview.Core 2006 * @since 9 2007 */ 2008 /** 2009 * isHttpAuthInfoSaved. 2010 * 2011 * @returns { boolean } 2012 * @syscap SystemCapability.Web.Webview.Core 2013 * @crossplatform 2014 * @atomicservice 2015 * @since 11 2016 */ 2017 isHttpAuthInfoSaved(): boolean; 2018} 2019 2020/** 2021 * Defines the ssl error request result, related to {@link onSslErrorEventReceive} method. 2022 * 2023 * @syscap SystemCapability.Web.Webview.Core 2024 * @since 9 2025 */ 2026/** 2027 * Defines the ssl error request result, related to {@link onSslErrorEventReceive} method. 2028 * 2029 * @syscap SystemCapability.Web.Webview.Core 2030 * @atomicservice 2031 * @since arkts {'1.1':'11', '1.2':'20'} 2032 * @arkts 1.1&1.2 2033 */ 2034declare class SslErrorHandler { 2035 /** 2036 * Constructor. 2037 * 2038 * @syscap SystemCapability.Web.Webview.Core 2039 * @since 9 2040 */ 2041 /** 2042 * Constructor. 2043 * 2044 * @syscap SystemCapability.Web.Webview.Core 2045 * @atomicservice 2046 * @since arkts {'1.1':'11', '1.2':'20'} 2047 * @arkts 1.1&1.2 2048 */ 2049 constructor(); 2050 2051 /** 2052 * Confirm to use the SSL certificate. 2053 * 2054 * @syscap SystemCapability.Web.Webview.Core 2055 * @since 9 2056 */ 2057 /** 2058 * Confirm to use the SSL certificate. 2059 * 2060 * @syscap SystemCapability.Web.Webview.Core 2061 * @atomicservice 2062 * @since 11 2063 */ 2064 handleConfirm(): void; 2065 2066 /** 2067 * Cancel this request. 2068 * 2069 * @syscap SystemCapability.Web.Webview.Core 2070 * @since 9 2071 */ 2072 /** 2073 * Cancel this request. 2074 * 2075 * @syscap SystemCapability.Web.Webview.Core 2076 * @atomicservice 2077 * @since 11 2078 */ 2079 handleCancel(): void; 2080 2081 /** 2082 * ArkWeb has encountered an SSL certificate error, and this interface indicates whether to terminate or 2083 * continue displaying the error to users. 2084 * 2085 * @param { boolean } abortLoading If abortLoading is true, the current request will be canceled and the 2086 * user will remain on the current page. If it is false, the SSL error 2087 * will not be ignored, and a blank page will be displayed. If a default 2088 * error page is enabled, the default error page will be shown instead. 2089 * The default value is false. 2090 * @syscap SystemCapability.Web.Webview.Core 2091 * @since 20 2092 */ 2093 handleCancel(abortLoading: boolean): void; 2094} 2095 2096/** 2097 * Defines the client certificate request result, related to {@link onClientAuthenticationRequest} method. 2098 * 2099 * @syscap SystemCapability.Web.Webview.Core 2100 * @since 9 2101 */ 2102/** 2103 * Defines the client certificate request result, related to {@link onClientAuthenticationRequest} method. 2104 * 2105 * @syscap SystemCapability.Web.Webview.Core 2106 * @atomicservice 2107 * @since arkts {'1.1':'11', '1.2':'20'} 2108 * @arkts 1.1&1.2 2109 */ 2110declare class ClientAuthenticationHandler { 2111 /** 2112 * Constructor. 2113 * 2114 * @syscap SystemCapability.Web.Webview.Core 2115 * @since 9 2116 */ 2117 /** 2118 * Constructor. 2119 * 2120 * @syscap SystemCapability.Web.Webview.Core 2121 * @atomicservice 2122 * @since arkts {'1.1':'11', '1.2':'20'} 2123 * @arkts 1.1&1.2 2124 */ 2125 constructor(); 2126 2127 /** 2128 * Confirm to use the specified private key and client certificate chain. 2129 * 2130 * @param { string } priKeyFile - The file that store private key. 2131 * @param { string } certChainFile - The file that store client certificate chain. 2132 * @syscap SystemCapability.Web.Webview.Core 2133 * @since 9 2134 */ 2135 /** 2136 * Confirm to use the specified private key and client certificate chain. 2137 * 2138 * @param { string } priKeyFile - The file that store private key. 2139 * @param { string } certChainFile - The file that store client certificate chain. 2140 * @syscap SystemCapability.Web.Webview.Core 2141 * @atomicservice 2142 * @since 11 2143 */ 2144 confirm(priKeyFile: string, certChainFile: string): void; 2145 2146 /** 2147 * Confirm to use the authUri.The authUri can be obtained from certificate management. 2148 * 2149 * @param { string } authUri is the key of credentials.The credentials contain sign info and client certificates info. 2150 * @syscap SystemCapability.Web.Webview.Core 2151 * @since 10 2152 */ 2153 /** 2154 * Confirm to use the authUri.The authUri can be obtained from certificate management. 2155 * 2156 * @param { string } authUri is the key of credentials.The credentials contain sign info and client certificates info. 2157 * @syscap SystemCapability.Web.Webview.Core 2158 * @atomicservice 2159 * @since 11 2160 */ 2161 confirm(authUri: string): void; 2162 2163 /** 2164 * Cancel this certificate request. 2165 * 2166 * @syscap SystemCapability.Web.Webview.Core 2167 * @since 9 2168 */ 2169 /** 2170 * Cancel this certificate request. 2171 * 2172 * @syscap SystemCapability.Web.Webview.Core 2173 * @atomicservice 2174 * @since 11 2175 */ 2176 cancel(): void; 2177 2178 /** 2179 * Ignore this certificate request temporarily. 2180 * 2181 * @syscap SystemCapability.Web.Webview.Core 2182 * @since 9 2183 */ 2184 /** 2185 * Ignore this certificate request temporarily. 2186 * 2187 * @syscap SystemCapability.Web.Webview.Core 2188 * @atomicservice 2189 * @since 11 2190 */ 2191 ignore(): void; 2192} 2193 2194/** 2195 * Defines the accessible resource type, related to {@link onPermissionRequest} method. 2196 * 2197 * @enum { string } 2198 * @syscap SystemCapability.Web.Webview.Core 2199 * @since 9 2200 */ 2201/** 2202 * Defines the accessible resource type, related to {@link onPermissionRequest} method. 2203 * 2204 * @enum { string } 2205 * @syscap SystemCapability.Web.Webview.Core 2206 * @crossplatform 2207 * @atomicservice 2208 * @since 11 2209 */ 2210declare enum ProtectedResourceType { 2211 /** 2212 * The MidiSysex resource. 2213 * 2214 * @syscap SystemCapability.Web.Webview.Core 2215 * @since 9 2216 */ 2217 /** 2218 * The MidiSysex resource. Currently, only permission events can be reported. MIDI devices are not yet supported. 2219 * 2220 * @syscap SystemCapability.Web.Webview.Core 2221 * @atomicservice 2222 * @since 11 2223 */ 2224 MidiSysex = 'TYPE_MIDI_SYSEX', 2225 2226 /** 2227 * The video capture resource, such as camera. 2228 * 2229 * @syscap SystemCapability.Web.Webview.Core 2230 * @since 10 2231 */ 2232 /** 2233 * The video capture resource, such as camera. 2234 * 2235 * @syscap SystemCapability.Web.Webview.Core 2236 * @crossplatform 2237 * @atomicservice 2238 * @since 11 2239 */ 2240 VIDEO_CAPTURE = 'TYPE_VIDEO_CAPTURE', 2241 2242 /** 2243 * The audio capture resource, such as microphone. 2244 * 2245 * @syscap SystemCapability.Web.Webview.Core 2246 * @since 10 2247 */ 2248 /** 2249 * The audio capture resource, such as microphone. 2250 * 2251 * @syscap SystemCapability.Web.Webview.Core 2252 * @crossplatform 2253 * @atomicservice 2254 * @since 11 2255 */ 2256 AUDIO_CAPTURE = 'TYPE_AUDIO_CAPTURE', 2257 2258 /** 2259 * The sensor resource, such as accelerometer. 2260 * 2261 * @syscap SystemCapability.Web.Webview.Core 2262 * @atomicservice 2263 * @since 12 2264 */ 2265 SENSOR = 'TYPE_SENSOR' 2266} 2267 2268/** 2269 * Defines the onPermissionRequest callback, related to {@link onPermissionRequest} method. 2270 * 2271 * @syscap SystemCapability.Web.Webview.Core 2272 * @since 9 2273 */ 2274/** 2275 * Implements the PermissionRequest object, related to {@link onPermissionRequest} method. 2276 * 2277 * @syscap SystemCapability.Web.Webview.Core 2278 * @crossplatform 2279 * @atomicservice 2280 * @since arkts {'1.1':'11', '1.2':'20'} 2281 * @arkts 1.1&1.2 2282 */ 2283declare class PermissionRequest { 2284 /** 2285 * Constructor. 2286 * 2287 * @syscap SystemCapability.Web.Webview.Core 2288 * @since 9 2289 */ 2290 /** 2291 * Constructor. 2292 * 2293 * @syscap SystemCapability.Web.Webview.Core 2294 * @crossplatform 2295 * @atomicservice 2296 * @since arkts {'1.1':'11', '1.2':'20'} 2297 * @arkts 1.1&1.2 2298 */ 2299 constructor(); 2300 2301 /** 2302 * Reject the request. 2303 * 2304 * @syscap SystemCapability.Web.Webview.Core 2305 * @since 9 2306 */ 2307 /** 2308 * Reject the request. 2309 * 2310 * @syscap SystemCapability.Web.Webview.Core 2311 * @crossplatform 2312 * @atomicservice 2313 * @since arkts {'1.1':'11', '1.2':'20'} 2314 * @arkts 1.1&1.2 2315 */ 2316 deny(): void; 2317 2318 /** 2319 * Gets the source if the webpage that attempted to access the restricted resource. 2320 * 2321 * @returns { string } 2322 * @syscap SystemCapability.Web.Webview.Core 2323 * @since 9 2324 */ 2325 /** 2326 * Gets the source if the webpage that attempted to access the restricted resource. 2327 * 2328 * @returns { string } 2329 * @syscap SystemCapability.Web.Webview.Core 2330 * @crossplatform 2331 * @atomicservice 2332 * @since arkts {'1.1':'11', '1.2':'20'} 2333 * @arkts 1.1&1.2 2334 */ 2335 getOrigin(): string; 2336 2337 /** 2338 * Gets the resource that the webpage is trying to access. 2339 * 2340 * @returns { Array<string> } 2341 * @syscap SystemCapability.Web.Webview.Core 2342 * @since 9 2343 */ 2344 /** 2345 * Obtains the list of accessible resources requested for the web page. 2346 * 2347 * @returns { Array<string> } List of accessible resources requested by the web page. 2348 * @syscap SystemCapability.Web.Webview.Core 2349 * @crossplatform 2350 * @atomicservice 2351 * @since arkts {'1.1':'11', '1.2':'20'} 2352 * @arkts 1.1&1.2 2353 */ 2354 getAccessibleResource(): Array<string>; 2355 2356 /** 2357 * Grant origin access to a given resource. 2358 * 2359 * @param { Array<string> } resources 2360 * @syscap SystemCapability.Web.Webview.Core 2361 * @since 9 2362 */ 2363 /** 2364 * Grant origin access to a given resource. 2365 * 2366 * @param { Array<string> } resources 2367 * @syscap SystemCapability.Web.Webview.Core 2368 * @crossplatform 2369 * @atomicservice 2370 * @since arkts {'1.1':'11', '1.2':'20'} 2371 * @arkts 1.1&1.2 2372 */ 2373 grant(resources: Array<string>): void; 2374} 2375 2376/** 2377 * Defines the onScreenCapture callback, related to {@link onScreenCapture} method. 2378 * @syscap SystemCapability.Web.Webview.Core 2379 * @since 10 2380 */ 2381/** 2382 * Defines the onScreenCapture callback, related to {@link onScreenCapture} method. 2383 * @syscap SystemCapability.Web.Webview.Core 2384 * @atomicservice 2385 * @since arkts {'1.1':'11', '1.2':'20'} 2386 * @arkts 1.1&1.2 2387 */ 2388declare class ScreenCaptureHandler { 2389 /** 2390 * Constructor. 2391 * @syscap SystemCapability.Web.Webview.Core 2392 * @since 10 2393 */ 2394 /** 2395 * Constructor. 2396 * @syscap SystemCapability.Web.Webview.Core 2397 * @atomicservice 2398 * @since arkts {'1.1':'11', '1.2':'20'} 2399 * @arkts 1.1&1.2 2400 */ 2401 constructor(); 2402 2403 /** 2404 * Gets the source of the webpage that attempted to access the restricted resource. 2405 * 2406 * @returns { string } 2407 * @syscap SystemCapability.Web.Webview.Core 2408 * @since 10 2409 */ 2410 /** 2411 * Obtains the origin of this web page. 2412 * 2413 * @returns { string } 2414 * @syscap SystemCapability.Web.Webview.Core 2415 * @atomicservice 2416 * @since 11 2417 */ 2418 getOrigin(): string; 2419 2420 /** 2421 * Grant origin access to a given resource. 2422 * @param { ScreenCaptureConfig } config The screen capture configuration. 2423 * @syscap SystemCapability.Web.Webview.Core 2424 * @since 10 2425 */ 2426 /** 2427 * Grants the screen capture permission. 2428 * @param { ScreenCaptureConfig } config The screen capture configuration. 2429 * @syscap SystemCapability.Web.Webview.Core 2430 * @atomicservice 2431 * @since arkts {'1.1':'11', '1.2':'20'} 2432 * @arkts 1.1&1.2 2433 */ 2434 grant(config: ScreenCaptureConfig): void; 2435 2436 /** 2437 * Reject the request. 2438 * @syscap SystemCapability.Web.Webview.Core 2439 * @since 10 2440 */ 2441 /** 2442 * Rejects this screen capture request. 2443 * @syscap SystemCapability.Web.Webview.Core 2444 * @atomicservice 2445 * @since arkts {'1.1':'11', '1.2':'20'} 2446 * @arkts 1.1&1.2 2447 */ 2448 deny(): void; 2449} 2450 2451/** 2452 * Defines the onDataResubmission callback, related to {@link onDataResubmission} method. 2453 * 2454 * @syscap SystemCapability.Web.Webview.Core 2455 * @since 9 2456 */ 2457/** 2458 * Defines the onDataResubmission callback, related to {@link onDataResubmission} method. 2459 * 2460 * @syscap SystemCapability.Web.Webview.Core 2461 * @atomicservice 2462 * @since arkts {'1.1':'11', '1.2':'20'} 2463 * @arkts 1.1&1.2 2464 */ 2465declare class DataResubmissionHandler { 2466 /** 2467 * Constructor. 2468 * 2469 * @syscap SystemCapability.Web.Webview.Core 2470 * @since 9 2471 */ 2472 /** 2473 * Constructor. 2474 * 2475 * @syscap SystemCapability.Web.Webview.Core 2476 * @atomicservice 2477 * @since arkts {'1.1':'11', '1.2':'20'} 2478 * @arkts 1.1&1.2 2479 */ 2480 constructor(); 2481 2482 /** 2483 * Resend related form data. 2484 * 2485 * @syscap SystemCapability.Web.Webview.Core 2486 * @since 9 2487 */ 2488 /** 2489 * Resend related form data. 2490 * 2491 * @syscap SystemCapability.Web.Webview.Core 2492 * @atomicservice 2493 * @since 11 2494 */ 2495 resend(): void; 2496 2497 /** 2498 * Do not resend related form data. 2499 * 2500 * @syscap SystemCapability.Web.Webview.Core 2501 * @since 9 2502 */ 2503 /** 2504 * Do not resend related form data. 2505 * 2506 * @syscap SystemCapability.Web.Webview.Core 2507 * @atomicservice 2508 * @since 11 2509 */ 2510 cancel(): void; 2511} 2512 2513/** 2514 * Defines the onWindowNew callback, related to {@link onWindowNew} method. 2515 * 2516 * @syscap SystemCapability.Web.Webview.Core 2517 * @since 9 2518 */ 2519/** 2520 * Defines the onWindowNew callback, related to {@link onWindowNew} method. 2521 * 2522 * @syscap SystemCapability.Web.Webview.Core 2523 * @atomicservice 2524 * @since 11 2525 */ 2526declare class ControllerHandler { 2527 /** 2528 * Constructor. 2529 * 2530 * @syscap SystemCapability.Web.Webview.Core 2531 * @since 9 2532 */ 2533 /** 2534 * Constructor. 2535 * 2536 * @syscap SystemCapability.Web.Webview.Core 2537 * @atomicservice 2538 * @since 11 2539 */ 2540 constructor(); 2541 2542 /** 2543 * Set WebController object. 2544 * 2545 * @param { WebviewController } controller 2546 * @syscap SystemCapability.Web.Webview.Core 2547 * @since 9 2548 */ 2549 /** 2550 * Set WebController object. 2551 * Set to null if you don't need to open a new window. 2552 * @param { WebviewController } controller 2553 * @syscap SystemCapability.Web.Webview.Core 2554 * @atomicservice 2555 * @since 11 2556 */ 2557 setWebController(controller: WebviewController): void; 2558} 2559 2560/** 2561 * Defines the context menu source type, related to {@link onContextMenuShow} method. 2562 * 2563 * @enum { number } 2564 * @syscap SystemCapability.Web.Webview.Core 2565 * @since 9 2566 */ 2567/** 2568 * Defines the context menu source type, related to {@link onContextMenuShow} method. 2569 * 2570 * @enum { number } 2571 * @syscap SystemCapability.Web.Webview.Core 2572 * @atomicservice 2573 * @since arkts {'1.1':'11', '1.2':'20'} 2574 * @arkts 1.1&1.2 2575 */ 2576declare enum ContextMenuSourceType { 2577 /** 2578 * Other source types. 2579 * 2580 * @syscap SystemCapability.Web.Webview.Core 2581 * @since 9 2582 */ 2583 /** 2584 * Other source types. 2585 * 2586 * @syscap SystemCapability.Web.Webview.Core 2587 * @atomicservice 2588 * @since arkts {'1.1':'11', '1.2':'20'} 2589 * @arkts 1.1&1.2 2590 */ 2591 None = 0, 2592 2593 /** 2594 * Mouse. 2595 * 2596 * @syscap SystemCapability.Web.Webview.Core 2597 * @since 9 2598 */ 2599 /** 2600 * Mouse. 2601 * 2602 * @syscap SystemCapability.Web.Webview.Core 2603 * @atomicservice 2604 * @since arkts {'1.1':'11', '1.2':'20'} 2605 * @arkts 1.1&1.2 2606 */ 2607 Mouse = 1, 2608 2609 /** 2610 * Long press. 2611 * 2612 * @syscap SystemCapability.Web.Webview.Core 2613 * @since 9 2614 */ 2615 /** 2616 * Long press. 2617 * 2618 * @syscap SystemCapability.Web.Webview.Core 2619 * @atomicservice 2620 * @since arkts {'1.1':'11', '1.2':'20'} 2621 * @arkts 1.1&1.2 2622 */ 2623 LongPress = 2 2624} 2625 2626/** 2627 * Defines the context menu media type, related to {@link onContextMenuShow} method. 2628 * 2629 * @enum { number } 2630 * @syscap SystemCapability.Web.Webview.Core 2631 * @since 9 2632 */ 2633/** 2634 * Defines the context menu media type, related to {@link onContextMenuShow} method. 2635 * 2636 * @enum { number } 2637 * @syscap SystemCapability.Web.Webview.Core 2638 * @atomicservice 2639 * @since arkts {'1.1':'11', '1.2':'20'} 2640 * @arkts 1.1&1.2 2641 */ 2642declare enum ContextMenuMediaType { 2643 /** 2644 * Not a special node or other media types. 2645 * 2646 * @syscap SystemCapability.Web.Webview.Core 2647 * @since 9 2648 */ 2649 /** 2650 * Not a special node or other media types. 2651 * 2652 * @syscap SystemCapability.Web.Webview.Core 2653 * @atomicservice 2654 * @since arkts {'1.1':'11', '1.2':'20'} 2655 * @arkts 1.1&1.2 2656 */ 2657 None = 0, 2658 2659 /** 2660 * Image. 2661 * 2662 * @syscap SystemCapability.Web.Webview.Core 2663 * @since 9 2664 */ 2665 /** 2666 * Image. 2667 * 2668 * @syscap SystemCapability.Web.Webview.Core 2669 * @atomicservice 2670 * @since arkts {'1.1':'11', '1.2':'20'} 2671 * @arkts 1.1&1.2 2672 */ 2673 Image = 1 2674} 2675 2676/** 2677 * Defines the context menu input field type, related to {@link onContextMenuShow} method. 2678 * 2679 * @enum { number } 2680 * @syscap SystemCapability.Web.Webview.Core 2681 * @since 9 2682 */ 2683/** 2684 * Defines the context menu input field type, related to {@link onContextMenuShow} method. 2685 * 2686 * @enum { number } 2687 * @syscap SystemCapability.Web.Webview.Core 2688 * @atomicservice 2689 * @since arkts {'1.1':'11', '1.2':'20'} 2690 * @arkts 1.1&1.2 2691 */ 2692declare enum ContextMenuInputFieldType { 2693 /** 2694 * Not an input field. 2695 * 2696 * @syscap SystemCapability.Web.Webview.Core 2697 * @since 9 2698 */ 2699 /** 2700 * Not an input field. 2701 * 2702 * @syscap SystemCapability.Web.Webview.Core 2703 * @atomicservice 2704 * @since arkts {'1.1':'11', '1.2':'20'} 2705 * @arkts 1.1&1.2 2706 */ 2707 None = 0, 2708 2709 /** 2710 * The plain text type. 2711 * 2712 * @syscap SystemCapability.Web.Webview.Core 2713 * @since 9 2714 */ 2715 /** 2716 * The plain text type. 2717 * 2718 * @syscap SystemCapability.Web.Webview.Core 2719 * @atomicservice 2720 * @since arkts {'1.1':'11', '1.2':'20'} 2721 * @arkts 1.1&1.2 2722 */ 2723 PlainText = 1, 2724 2725 /** 2726 * The password type. 2727 * 2728 * @syscap SystemCapability.Web.Webview.Core 2729 * @since 9 2730 */ 2731 /** 2732 * The password type. 2733 * 2734 * @syscap SystemCapability.Web.Webview.Core 2735 * @atomicservice 2736 * @since arkts {'1.1':'11', '1.2':'20'} 2737 * @arkts 1.1&1.2 2738 */ 2739 Password = 2, 2740 2741 /** 2742 * The number type. 2743 * 2744 * @syscap SystemCapability.Web.Webview.Core 2745 * @since 9 2746 */ 2747 /** 2748 * The number type. 2749 * 2750 * @syscap SystemCapability.Web.Webview.Core 2751 * @atomicservice 2752 * @since arkts {'1.1':'11', '1.2':'20'} 2753 * @arkts 1.1&1.2 2754 */ 2755 Number = 3, 2756 2757 /** 2758 * The telephone type. 2759 * 2760 * @syscap SystemCapability.Web.Webview.Core 2761 * @since 9 2762 */ 2763 /** 2764 * The telephone type. 2765 * 2766 * @syscap SystemCapability.Web.Webview.Core 2767 * @atomicservice 2768 * @since arkts {'1.1':'11', '1.2':'20'} 2769 * @arkts 1.1&1.2 2770 */ 2771 Telephone = 4, 2772 2773 /** 2774 * Other types. 2775 * 2776 * @syscap SystemCapability.Web.Webview.Core 2777 * @since 9 2778 */ 2779 /** 2780 * Other types. 2781 * 2782 * @syscap SystemCapability.Web.Webview.Core 2783 * @atomicservice 2784 * @since arkts {'1.1':'11', '1.2':'20'} 2785 * @arkts 1.1&1.2 2786 */ 2787 Other = 5 2788} 2789 2790/** 2791 * Defines the lifecycle of the same-layer tag. 2792 * When the same-layer tag exists on the loaded page, 2793 * CREATE is triggered. When the same-layer tag is moved or is enlarged, 2794 * **UPDATE **is triggered. When the page exits, DESTROY is triggered. 2795 * 2796 * @enum { number } 2797 * @syscap SystemCapability.Web.Webview.Core 2798 * @atomicservice 2799 * @since 11 2800 */ 2801declare enum NativeEmbedStatus { 2802 /** 2803 * The same-layer tag is created. 2804 * 2805 * @syscap SystemCapability.Web.Webview.Core 2806 * @atomicservice 2807 * @since 11 2808 */ 2809 CREATE = 0, 2810 2811 /** 2812 * The same-layer tag is updated. 2813 * 2814 * @syscap SystemCapability.Web.Webview.Core 2815 * @atomicservice 2816 * @since 11 2817 */ 2818 UPDATE = 1, 2819 2820 /** 2821 *The same-layer tag is destroyed. 2822 * 2823 * @syscap SystemCapability.Web.Webview.Core 2824 * @atomicservice 2825 * @since 11 2826 */ 2827 DESTROY = 2, 2828 2829 /** 2830 * The same-layer tag enters the BFCache. 2831 * 2832 * @syscap SystemCapability.Web.Webview.Core 2833 * @atomicservice 2834 * @since 12 2835 */ 2836 ENTER_BFCACHE = 3, 2837 2838 /** 2839 * The same-layer tag leaves the BFCache. 2840 * 2841 * @syscap SystemCapability.Web.Webview.Core 2842 * @atomicservice 2843 * @since 12 2844 */ 2845 LEAVE_BFCACHE = 4 2846} 2847 2848/** 2849 * Defines the context menu supported event bit flags, related to {@link onContextMenuShow} method. 2850 * 2851 * @enum { number } 2852 * @syscap SystemCapability.Web.Webview.Core 2853 * @since 9 2854 */ 2855/** 2856 * Defines the context menu supported event bit flags, related to {@link onContextMenuShow} method. 2857 * 2858 * @enum { number } 2859 * @syscap SystemCapability.Web.Webview.Core 2860 * @atomicservice 2861 * @since 11 2862 */ 2863declare enum ContextMenuEditStateFlags { 2864 /** 2865 * Not editable. 2866 * 2867 * @syscap SystemCapability.Web.Webview.Core 2868 * @since 9 2869 */ 2870 /** 2871 * Not editable. 2872 * 2873 * @syscap SystemCapability.Web.Webview.Core 2874 * @atomicservice 2875 * @since 11 2876 */ 2877 NONE = 0, 2878 2879 /** 2880 * Clipping is supported. 2881 * 2882 * @syscap SystemCapability.Web.Webview.Core 2883 * @since 9 2884 */ 2885 /** 2886 * Clipping is supported. 2887 * 2888 * @syscap SystemCapability.Web.Webview.Core 2889 * @atomicservice 2890 * @since 11 2891 */ 2892 CAN_CUT = 1 << 0, 2893 2894 /** 2895 * Copies are supported. 2896 * 2897 * @syscap SystemCapability.Web.Webview.Core 2898 * @since 9 2899 */ 2900 /** 2901 * Copies are supported. 2902 * 2903 * @syscap SystemCapability.Web.Webview.Core 2904 * @atomicservice 2905 * @since 11 2906 */ 2907 CAN_COPY = 1 << 1, 2908 2909 /** 2910 * Support for pasting. 2911 * 2912 * @syscap SystemCapability.Web.Webview.Core 2913 * @since 9 2914 */ 2915 /** 2916 * Pasting is supported. 2917 * 2918 * @syscap SystemCapability.Web.Webview.Core 2919 * @atomicservice 2920 * @since 11 2921 */ 2922 CAN_PASTE = 1 << 2, 2923 2924 /** 2925 * Select all is supported. 2926 * 2927 * @syscap SystemCapability.Web.Webview.Core 2928 * @since 9 2929 */ 2930 /** 2931 * Select all is supported. 2932 * 2933 * @syscap SystemCapability.Web.Webview.Core 2934 * @atomicservice 2935 * @since 11 2936 */ 2937 CAN_SELECT_ALL = 1 << 3 2938} 2939 2940/** 2941 * Enum type supplied to {@link navigationType} for the navigation's type. 2942 * 2943 * @enum { number } 2944 * @syscap SystemCapability.Web.Webview.Core 2945 * @atomicservice 2946 * @since 11 2947 */ 2948declare enum WebNavigationType { 2949 /** 2950 * Unknown type. 2951 * 2952 * @syscap SystemCapability.Web.Webview.Core 2953 * @atomicservice 2954 * @since 11 2955 */ 2956 UNKNOWN = 0, 2957 2958 /** 2959 * A new entry was created due to a navigation happened on the main frame. 2960 * Contains all situations that will generate a mainframe navigation entry, 2961 * which means that navigations to a hash on the same document or history.pushState 2962 * also belong to this type. 2963 * 2964 * @syscap SystemCapability.Web.Webview.Core 2965 * @atomicservice 2966 * @since 11 2967 */ 2968 MAIN_FRAME_NEW_ENTRY = 1, 2969 2970 /** 2971 * Navigate to an existing entry due to a navigation on the main frame. 2972 * e.g. 2973 * 1. History navigations. 2974 * 2. Reloads (contains loading the same url). 2975 * 3. Same-document navigations(history.replaceState(), location.replace()). 2976 * 2977 * @syscap SystemCapability.Web.Webview.Core 2978 * @atomicservice 2979 * @since 11 2980 */ 2981 MAIN_FRAME_EXISTING_ENTRY = 2, 2982 2983 /** 2984 * A navigation happened on subframe which was triggered by user. 2985 * 2986 * @syscap SystemCapability.Web.Webview.Core 2987 * @atomicservice 2988 * @since 11 2989 */ 2990 NAVIGATION_TYPE_NEW_SUBFRAME = 4, 2991 2992 /** 2993 * A navigation happened on the subframe automatically. 2994 * 2995 * @syscap SystemCapability.Web.Webview.Core 2996 * @atomicservice 2997 * @since 11 2998 */ 2999 NAVIGATION_TYPE_AUTO_SUBFRAME = 5 3000} 3001 3002/** 3003 * Enumerates the rendering mode of Web components. By default, the asynchronous rendering mode is used. 3004 * The asynchronous rendering mode is recommended because it has better performance and lower power consumption. 3005 * 3006 * @enum { number } 3007 * @syscap SystemCapability.Web.Webview.Core 3008 * @atomicservice 3009 * @since arkts {'1.1':'12', '1.2':'20'} 3010 * @arkts 1.1&1.2 3011 */ 3012declare enum RenderMode { 3013 /** 3014 * The Web component is rendered asynchronously. 3015 * The ArkWeb component as a graphic surface node is displayed independently. 3016 * The maximum width of the Web component is 7,680 px (physical pixel). 3017 * 3018 * @syscap SystemCapability.Web.Webview.Core 3019 * @atomicservice 3020 * @since arkts {'1.1':'12', '1.2':'20'} 3021 * @arkts 1.1&1.2 3022 */ 3023 ASYNC_RENDER = 0, 3024 3025 /** 3026 * The Web component is rendered synchronously. 3027 * The ArkWeb component as a graphic canvas node is displayed together with the system component. 3028 * The maximum width of the Web component is 500,000 px (physical pixel). 3029 * 3030 * @syscap SystemCapability.Web.Webview.Core 3031 * @atomicservice 3032 * @since arkts {'1.1':'12', '1.2':'20'} 3033 * @arkts 1.1&1.2 3034 */ 3035 SYNC_RENDER = 1 3036} 3037 3038/** 3039 * Defines the viewport-fit type, related to {@link ViewportFit}. 3040 * 3041 * @enum { number } 3042 * @syscap SystemCapability.Web.Webview.Core 3043 * @atomicservice 3044 * @since 12 3045 */ 3046declare enum ViewportFit { 3047 /** 3048 * No effect - the whole web page is viewable(default) 3049 * 3050 * @syscap SystemCapability.Web.Webview.Core 3051 * @atomicservice 3052 * @since 12 3053 */ 3054 AUTO = 0, 3055 3056 /** 3057 * The initial layout viewport and the visual viewport are set to the 3058 * largest rectangle which is inscribe in the display of the device. 3059 * 3060 * @syscap SystemCapability.Web.Webview.Core 3061 * @atomicservice 3062 * @since 12 3063 */ 3064 CONTAINS = 1, 3065 3066 /** 3067 * The initial layout viewport and the visual viewport are set to the 3068 * circumscribe rectangle of the physical screen of the device. 3069 * 3070 * @syscap SystemCapability.Web.Webview.Core 3071 * @atomicservice 3072 * @since 12 3073 */ 3074 COVER = 2 3075} 3076 3077/** 3078 * Defines the context menu param, related to {@link WebContextMenuParam} method. 3079 * 3080 * @syscap SystemCapability.Web.Webview.Core 3081 * @since 9 3082 */ 3083/** 3084 * Defines the context menu param, related to {@link WebContextMenuParam} method. 3085 * 3086 * @syscap SystemCapability.Web.Webview.Core 3087 * @atomicservice 3088 * @since arkts {'1.1':'11', '1.2':'20'} 3089 * @arkts 1.1&1.2 3090 */ 3091declare class WebContextMenuParam { 3092 /** 3093 * Constructor. 3094 * 3095 * @syscap SystemCapability.Web.Webview.Core 3096 * @since 9 3097 */ 3098 /** 3099 * Constructor. 3100 * 3101 * @syscap SystemCapability.Web.Webview.Core 3102 * @atomicservice 3103 * @since arkts {'1.1':'11', '1.2':'20'} 3104 * @arkts 1.1&1.2 3105 */ 3106 constructor(); 3107 3108 /** 3109 * Horizontal offset coordinates of the menu within the Web component. 3110 * 3111 * @returns { number } The context menu x coordinate. 3112 * @syscap SystemCapability.Web.Webview.Core 3113 * @since 9 3114 */ 3115 /** 3116 * Horizontal offset coordinates of the menu within the Web component. 3117 * 3118 * @returns { number } The context menu x coordinate. 3119 * Returns a non-negative integer if normal, otherwise returns -1. 3120 * Unit: vp. 3121 * @syscap SystemCapability.Web.Webview.Core 3122 * @atomicservice 3123 * @since arkts {'1.1':'11', '1.2':'20'} 3124 * @arkts 1.1&1.2 3125 */ 3126 x(): number; 3127 3128 /** 3129 * Vertical offset coordinates for the menu within the Web component. 3130 * 3131 * @returns { number } The context menu y coordinate. 3132 * @syscap SystemCapability.Web.Webview.Core 3133 * @since 9 3134 */ 3135 /** 3136 * Vertical offset coordinates for the menu within the Web component. 3137 * 3138 * @returns { number } The context menu y coordinate. 3139 * Returns a non-negative integer if normal, otherwise returns -1. 3140 * Unit: vp. 3141 * @syscap SystemCapability.Web.Webview.Core 3142 * @atomicservice 3143 * @since arkts {'1.1':'11', '1.2':'20'} 3144 * @arkts 1.1&1.2 3145 */ 3146 y(): number; 3147 3148 /** 3149 * If the long-press location is the link returns the link's security-checked URL. 3150 * 3151 * @returns { string } If relate to a link return link url, else return null. 3152 * @syscap SystemCapability.Web.Webview.Core 3153 * @since 9 3154 */ 3155 /** 3156 * If the long-press location is the link returns the link's security-checked URL. 3157 * 3158 * @returns { string } If relate to a link return link url, else return null. 3159 * @syscap SystemCapability.Web.Webview.Core 3160 * @atomicservice 3161 * @since arkts {'1.1':'11', '1.2':'20'} 3162 * @arkts 1.1&1.2 3163 */ 3164 getLinkUrl(): string; 3165 3166 /** 3167 * If the long-press location is the link returns the link's original URL. 3168 * 3169 * @returns { string } If relate to a link return unfiltered link url, else return null. 3170 * @syscap SystemCapability.Web.Webview.Core 3171 * @since 9 3172 */ 3173 /** 3174 * If the long-press location is the link returns the link's original URL. 3175 * 3176 * @returns { string } If relate to a link return unfiltered link url, else return null. 3177 * @syscap SystemCapability.Web.Webview.Core 3178 * @atomicservice 3179 * @since arkts {'1.1':'11', '1.2':'20'} 3180 * @arkts 1.1&1.2 3181 */ 3182 getUnfilteredLinkUrl(): string; 3183 3184 /** 3185 * Returns the SRC URL if the selected element has a SRC attribute. 3186 * 3187 * @returns { string } If this context menu is "src" attribute, return link url, else return null. 3188 * @syscap SystemCapability.Web.Webview.Core 3189 * @since 9 3190 */ 3191 /** 3192 * Returns the SRC URL if the selected element has a SRC attribute. 3193 * 3194 * @returns { string } If this context menu is "src" attribute, return link url, else return null. 3195 * @syscap SystemCapability.Web.Webview.Core 3196 * @atomicservice 3197 * @since arkts {'1.1':'11', '1.2':'20'} 3198 * @arkts 1.1&1.2 3199 */ 3200 getSourceUrl(): string; 3201 3202 /** 3203 * Long press menu location has image content. 3204 * 3205 * @returns { boolean } Return whether this context menu has image content. 3206 * @syscap SystemCapability.Web.Webview.Core 3207 * @since 9 3208 */ 3209 /** 3210 * Long press menu location has image content. 3211 * 3212 * @returns { boolean } Return whether this context menu has image content. 3213 * @syscap SystemCapability.Web.Webview.Core 3214 * @atomicservice 3215 * @since arkts {'1.1':'11', '1.2':'20'} 3216 * @arkts 1.1&1.2 3217 */ 3218 existsImageContents(): boolean; 3219 3220 /** 3221 * Returns the type of context node. 3222 * 3223 * @returns { ContextMenuMediaType } Returns the type of context node. 3224 * @syscap SystemCapability.Web.Webview.Core 3225 * @since 9 3226 */ 3227 /** 3228 * Returns the type of context node. 3229 * 3230 * @returns { ContextMenuMediaType } Returns the type of context node. 3231 * @syscap SystemCapability.Web.Webview.Core 3232 * @atomicservice 3233 * @since arkts {'1.1':'11', '1.2':'20'} 3234 * @arkts 1.1&1.2 3235 */ 3236 getMediaType(): ContextMenuMediaType; 3237 3238 /** 3239 * Returns the text of the selection. 3240 * 3241 * @returns { string } Returns the text of the selection. 3242 * @syscap SystemCapability.Web.Webview.Core 3243 * @since 9 3244 */ 3245 /** 3246 * Returns the text of the selection. 3247 * 3248 * @returns { string } Returns the text of the selection, or return null if no text is selected. 3249 * @syscap SystemCapability.Web.Webview.Core 3250 * @atomicservice 3251 * @since arkts {'1.1':'11', '1.2':'20'} 3252 * @arkts 1.1&1.2 3253 */ 3254 getSelectionText(): string; 3255 3256 /** 3257 * Returns the context menu source type. 3258 * 3259 * @returns { ContextMenuSourceType } 3260 * @syscap SystemCapability.Web.Webview.Core 3261 * @since 9 3262 */ 3263 /** 3264 * Returns the context menu source type. 3265 * 3266 * @returns { ContextMenuSourceType } 3267 * @syscap SystemCapability.Web.Webview.Core 3268 * @atomicservice 3269 * @since arkts {'1.1':'11', '1.2':'20'} 3270 * @arkts 1.1&1.2 3271 */ 3272 getSourceType(): ContextMenuSourceType; 3273 3274 /** 3275 * Returns input field type if the context menu was invoked on an input field. 3276 * 3277 * @returns { ContextMenuInputFieldType } Input field type if the context menu was invoked on an input field. 3278 * @syscap SystemCapability.Web.Webview.Core 3279 * @since 9 3280 */ 3281 /** 3282 * Returns input field type if the context menu was invoked on an input field. 3283 * 3284 * @returns { ContextMenuInputFieldType } Input field type if the context menu was invoked on an input field. 3285 * @syscap SystemCapability.Web.Webview.Core 3286 * @atomicservice 3287 * @since arkts {'1.1':'11', '1.2':'20'} 3288 * @arkts 1.1&1.2 3289 */ 3290 getInputFieldType(): ContextMenuInputFieldType; 3291 3292 /** 3293 * Returns whether the context is editable. 3294 * 3295 * @returns { boolean } 3296 * @syscap SystemCapability.Web.Webview.Core 3297 * @since 9 3298 */ 3299 /** 3300 * Returns whether the context is editable. 3301 * 3302 * @returns { boolean } 3303 * @syscap SystemCapability.Web.Webview.Core 3304 * @atomicservice 3305 * @since arkts {'1.1':'11', '1.2':'20'} 3306 * @arkts 1.1&1.2 3307 */ 3308 isEditable(): boolean; 3309 3310 /** 3311 * Returns the context editable flags {@link ContextMenuEditStateFlags}. 3312 * 3313 * @returns { number } 3314 * @syscap SystemCapability.Web.Webview.Core 3315 * @since 9 3316 */ 3317 /** 3318 * Returns the context editable flags {@link ContextMenuEditStateFlags}. 3319 * 3320 * @returns { number } 3321 * @syscap SystemCapability.Web.Webview.Core 3322 * @atomicservice 3323 * @since arkts {'1.1':'11', '1.2':'20'} 3324 * @arkts 1.1&1.2 3325 */ 3326 getEditStateFlags(): number; 3327 3328 /** 3329 * Returns the selection menu preview width. 3330 * 3331 * @returns { number } The preview menu width. 3332 * @syscap SystemCapability.Web.Webview.Core 3333 * @since arkts {'1.1':'13', '1.2':'20'} 3334 * @arkts 1.1&1.2 3335 */ 3336 getPreviewWidth(): number; 3337 3338 /** 3339 * Returns the selection menu preview height. 3340 * 3341 * @returns { number } The preview menu height. 3342 * @syscap SystemCapability.Web.Webview.Core 3343 * @since arkts {'1.1':'13', '1.2':'20'} 3344 * @arkts 1.1&1.2 3345 */ 3346 getPreviewHeight(): number; 3347} 3348 3349/** 3350 * Defines the context menu result, related to {@link WebContextMenuResult} method. 3351 * 3352 * @syscap SystemCapability.Web.Webview.Core 3353 * @since 9 3354 */ 3355/** 3356 * Defines the context menu result, related to {@link WebContextMenuResult} method. 3357 * 3358 * @syscap SystemCapability.Web.Webview.Core 3359 * @atomicservice 3360 * @since arkts {'1.1':'11', '1.2':'20'} 3361 * @arkts 1.1&1.2 3362 */ 3363declare class WebContextMenuResult { 3364 /** 3365 * Constructor. 3366 * 3367 * @syscap SystemCapability.Web.Webview.Core 3368 * @since 9 3369 */ 3370 /** 3371 * Constructor. 3372 * 3373 * @syscap SystemCapability.Web.Webview.Core 3374 * @atomicservice 3375 * @since arkts {'1.1':'11', '1.2':'20'} 3376 * @arkts 1.1&1.2 3377 */ 3378 constructor(); 3379 3380 /** 3381 * When close context menu without other call in WebContextMenuResult, 3382 * User should call this function to close menu 3383 * 3384 * @syscap SystemCapability.Web.Webview.Core 3385 * @since 9 3386 */ 3387 /** 3388 * When close context menu without other call in WebContextMenuResult, 3389 * User should call this function to close menu 3390 * 3391 * @syscap SystemCapability.Web.Webview.Core 3392 * @atomicservice 3393 * @since arkts {'1.1':'11', '1.2':'20'} 3394 * @arkts 1.1&1.2 3395 */ 3396 closeContextMenu(): void; 3397 3398 /** 3399 * If WebContextMenuParam has image content, this function will copy image related to this context menu. 3400 * If WebContextMenuParam has no image content, this function will do nothing. 3401 * 3402 * @syscap SystemCapability.Web.Webview.Core 3403 * @since 9 3404 */ 3405 /** 3406 * If WebContextMenuParam has image content, this function will copy image related to this context menu. 3407 * If WebContextMenuParam has no image content, this function will do nothing. 3408 * 3409 * @syscap SystemCapability.Web.Webview.Core 3410 * @atomicservice 3411 * @since arkts {'1.1':'11', '1.2':'20'} 3412 * @arkts 1.1&1.2 3413 */ 3414 copyImage(): void; 3415 3416 /** 3417 * Executes the copy operation related to this context menu. 3418 * 3419 * @syscap SystemCapability.Web.Webview.Core 3420 * @since 9 3421 */ 3422 /** 3423 * Executes the copy operation related to this context menu. 3424 * 3425 * @syscap SystemCapability.Web.Webview.Core 3426 * @atomicservice 3427 * @since arkts {'1.1':'11', '1.2':'20'} 3428 * @arkts 1.1&1.2 3429 */ 3430 copy(): void; 3431 3432 /** 3433 * Executes the paste operation related to this context menu. 3434 * 3435 * @syscap SystemCapability.Web.Webview.Core 3436 * @since 9 3437 */ 3438 /** 3439 * Executes the paste operation related to this context menu. 3440 * 3441 * <p><strong>API Note</strong>:<br> 3442 * Permissions need to be configured: ohos.permission.READ_PASTEBOARD. 3443 * </p> 3444 * 3445 * @syscap SystemCapability.Web.Webview.Core 3446 * @atomicservice 3447 * @since arkts {'1.1':'11', '1.2':'20'} 3448 * @arkts 1.1&1.2 3449 */ 3450 paste(): void; 3451 3452 /** 3453 * Executes the cut operation related to this context menu. 3454 * 3455 * @syscap SystemCapability.Web.Webview.Core 3456 * @since 9 3457 */ 3458 /** 3459 * Executes the cut operation related to this context menu. 3460 * 3461 * @syscap SystemCapability.Web.Webview.Core 3462 * @atomicservice 3463 * @since arkts {'1.1':'11', '1.2':'20'} 3464 * @arkts 1.1&1.2 3465 */ 3466 cut(): void; 3467 3468 /** 3469 * Executes the selectAll operation related to this context menu. 3470 * 3471 * @syscap SystemCapability.Web.Webview.Core 3472 * @since 9 3473 */ 3474 /** 3475 * Executes the selectAll operation related to this context menu. 3476 * 3477 * @syscap SystemCapability.Web.Webview.Core 3478 * @atomicservice 3479 * @since arkts {'1.1':'11', '1.2':'20'} 3480 * @arkts 1.1&1.2 3481 */ 3482 selectAll(): void; 3483 3484 /** 3485 * Executes the redo operation related to this context menu. 3486 * 3487 * @syscap SystemCapability.Web.Webview.Core 3488 * @since 20 3489 */ 3490 redo(): void; 3491 3492 /** 3493 * Executes the undo operation related to this context menu. 3494 * 3495 * @syscap SystemCapability.Web.Webview.Core 3496 * @since 20 3497 */ 3498 undo(): void; 3499 3500 /** 3501 * Executes the paste and match style operation related to this context menu. 3502 * 3503 * <p><strong>API Note</strong>:<br> 3504 * Permissions need to be configured: ohos.permission.READ_PASTEBOARD. 3505 * </p> 3506 * 3507 * @syscap SystemCapability.Web.Webview.Core 3508 * @since 20 3509 */ 3510 pasteAndMatchStyle(): void; 3511} 3512 3513/** 3514 * Encompassed message information as parameters to {@link onConsole} method. 3515 * 3516 * @syscap SystemCapability.Web.Webview.Core 3517 * @since 8 3518 */ 3519/** 3520 * Encompassed message information as parameters to {@link onConsole} method. 3521 * 3522 * @syscap SystemCapability.Web.Webview.Core 3523 * @crossplatform 3524 * @atomicservice 3525 * @since arkts {'1.1':'11', '1.2':'20'} 3526 * @arkts 1.1&1.2 3527 */ 3528declare class ConsoleMessage { 3529 /** 3530 * Constructor. 3531 * 3532 * @param { string } message - The console message. 3533 * @param { string } sourceId - The Web source file's path and name. 3534 * @param { number } lineNumber - The line number of the console message. 3535 * @param { MessageLevel } messageLevel - The console log level. 3536 * @syscap SystemCapability.Web.Webview.Core 3537 * @since 8 3538 * @deprecated since 9 3539 * @useinstead ohos.web.ConsoleMessage#constructor 3540 */ 3541 constructor(message: string, sourceId: string, lineNumber: number, messageLevel: MessageLevel); 3542 3543 /** 3544 * Constructor. 3545 * 3546 * @syscap SystemCapability.Web.Webview.Core 3547 * @since 9 3548 */ 3549 /** 3550 * Constructor. 3551 * 3552 * @syscap SystemCapability.Web.Webview.Core 3553 * @crossplatform 3554 * @atomicservice 3555 * @since arkts {'1.1':'11', '1.2':'20'} 3556 * @arkts 1.1&1.2 3557 */ 3558 constructor(); 3559 3560 /** 3561 * Gets the message of a console message. 3562 * 3563 * @returns { string } Return the message of a console message. 3564 * @syscap SystemCapability.Web.Webview.Core 3565 * @since 8 3566 */ 3567 /** 3568 * Gets the message of a console message. 3569 * 3570 * @returns { string } Return the message of a console message. 3571 * @syscap SystemCapability.Web.Webview.Core 3572 * @crossplatform 3573 * @atomicservice 3574 * @since 11 3575 */ 3576 getMessage(): string; 3577 3578 /** 3579 * Gets the Web source file's path and name of a console message. 3580 * 3581 * @returns { string } Return the Web source file's path and name of a console message. 3582 * @syscap SystemCapability.Web.Webview.Core 3583 * @since 8 3584 */ 3585 /** 3586 * Gets the Web source file's path and name of a console message. 3587 * 3588 * @returns { string } Return the Web source file's path and name of a console message. 3589 * @syscap SystemCapability.Web.Webview.Core 3590 * @atomicservice 3591 * @since 11 3592 */ 3593 /** 3594 * Gets the Web source file's path and name of a console message. 3595 * 3596 * @returns { string } Return the Web source file's path and name of a console message. 3597 * @syscap SystemCapability.Web.Webview.Core 3598 * @crossplatform 3599 * @atomicservice 3600 * @since 18 3601 */ 3602 getSourceId(): string; 3603 3604 /** 3605 * Gets the line number of a console message. 3606 * 3607 * @returns { number } Return the line number of a console message. 3608 * @syscap SystemCapability.Web.Webview.Core 3609 * @since 8 3610 */ 3611 /** 3612 * Gets the line number of a console message. 3613 * 3614 * @returns { number } Return the line number of a console message. 3615 * @syscap SystemCapability.Web.Webview.Core 3616 * @atomicservice 3617 * @since 11 3618 */ 3619 /** 3620 * Gets the line number of a console message. 3621 * 3622 * @returns { number } Return the line number of a console message. 3623 * @syscap SystemCapability.Web.Webview.Core 3624 * @crossplatform 3625 * @atomicservice 3626 * @since 18 3627 */ 3628 getLineNumber(): number; 3629 3630 /** 3631 * Gets the message level of a console message. 3632 * 3633 * @returns { MessageLevel } Return the message level of a console message, which can be {@link MessageLevel}. 3634 * @syscap SystemCapability.Web.Webview.Core 3635 * @since 8 3636 */ 3637 /** 3638 * Gets the message level of a console message. 3639 * 3640 * @returns { MessageLevel } Return the message level of a console message, which can be {@link MessageLevel}. 3641 * @syscap SystemCapability.Web.Webview.Core 3642 * @crossplatform 3643 * @atomicservice 3644 * @since 11 3645 */ 3646 getMessageLevel(): MessageLevel; 3647} 3648 3649/** 3650 * Encompassed message information as parameters to {@link onConsole} method. 3651 * 3652 * @syscap SystemCapability.Web.Webview.Core 3653 * @since 8 3654 */ 3655/** 3656 * Defines the Web resource request. 3657 * 3658 * @syscap SystemCapability.Web.Webview.Core 3659 * @since 8 3660 */ 3661/** 3662 * Defines the Web resource request. 3663 * 3664 * @syscap SystemCapability.Web.Webview.Core 3665 * @crossplatform 3666 * @since 10 3667 */ 3668/** 3669 * Defines the Web resource request. 3670 * 3671 * @syscap SystemCapability.Web.Webview.Core 3672 * @crossplatform 3673 * @atomicservice 3674 * @since arkts {'1.1':'11', '1.2':'20'} 3675 * @arkts 1.1&1.2 3676 */ 3677declare class WebResourceRequest { 3678 /** 3679 * Constructor. 3680 * 3681 * @syscap SystemCapability.Web.Webview.Core 3682 * @since 8 3683 */ 3684 /** 3685 * Constructor. 3686 * 3687 * @syscap SystemCapability.Web.Webview.Core 3688 * @crossplatform 3689 * @since 10 3690 */ 3691 /** 3692 * Constructor. 3693 * 3694 * @syscap SystemCapability.Web.Webview.Core 3695 * @crossplatform 3696 * @atomicservice 3697 * @since arkts {'1.1':'11', '1.2':'20'} 3698 * @arkts 1.1&1.2 3699 */ 3700 constructor(); 3701 3702 /** 3703 * Gets request headers. 3704 * 3705 * @returns { Array<Header> } Return the request headers 3706 * @syscap SystemCapability.Web.Webview.Core 3707 * @since 8 3708 */ 3709 /** 3710 * Gets request headers. 3711 * 3712 * @returns { Array<Header> } Return the request headers 3713 * @syscap SystemCapability.Web.Webview.Core 3714 * @atomicservice 3715 * @since 11 3716 */ 3717 /** 3718 * Gets request headers. 3719 * 3720 * @returns { Array<Header> } Return the request headers 3721 * @syscap SystemCapability.Web.Webview.Core 3722 * @crossplatform 3723 * @atomicservice 3724 * @since 18 3725 */ 3726 getRequestHeader(): Array<Header>; 3727 3728 /** 3729 * Gets the request URL. 3730 * 3731 * @returns { string } Return the request URL. 3732 * @syscap SystemCapability.Web.Webview.Core 3733 * @since 8 3734 */ 3735 /** 3736 * Gets the request URL. 3737 * 3738 * @returns { string } Return the request URL. 3739 * @syscap SystemCapability.Web.Webview.Core 3740 * @crossplatform 3741 * @since 10 3742 */ 3743 /** 3744 * Gets the request URL. 3745 * 3746 * @returns { string } Return the request URL. 3747 * @syscap SystemCapability.Web.Webview.Core 3748 * @crossplatform 3749 * @atomicservice 3750 * @since 11 3751 */ 3752 getRequestUrl(): string; 3753 3754 /** 3755 * Check whether the request is associated with gesture. 3756 * 3757 * @returns { boolean } Return {@code true} if the request is associated with gesture;return {@code false} otherwise. 3758 * @syscap SystemCapability.Web.Webview.Core 3759 * @since 8 3760 */ 3761 /** 3762 * Check whether the request is associated with gesture. 3763 * 3764 * @returns { boolean } Return {@code true} if the request is associated with gesture;return {@code false} otherwise. 3765 * @syscap SystemCapability.Web.Webview.Core 3766 * @atomicservice 3767 * @since 11 3768 */ 3769 /** 3770 * Check whether the request is associated with gesture. 3771 * 3772 * @returns { boolean } Return {@code true} if the request is associated with gesture;return {@code false} otherwise. 3773 * @syscap SystemCapability.Web.Webview.Core 3774 * @crossplatform 3775 * @atomicservice 3776 * @since 18 3777 */ 3778 isRequestGesture(): boolean; 3779 3780 /** 3781 * Check whether the request is for getting the main frame. 3782 * 3783 * @returns { boolean } Return {@code true} if the request is associated with gesture for getting the main frame; return {@code false} otherwise. 3784 * @syscap SystemCapability.Web.Webview.Core 3785 * @since 8 3786 */ 3787 /** 3788 * Check whether the request is for getting the main frame. 3789 * 3790 * @returns { boolean } Return {@code true} if the request is associated with gesture for getting the main frame; return {@code false} otherwise. 3791 * @syscap SystemCapability.Web.Webview.Core 3792 * @atomicservice 3793 * @since 11 3794 */ 3795 /** 3796 * Check whether the request is for getting the main frame. 3797 * 3798 * @returns { boolean } Return {@code true} if the request is associated with gesture for getting the main frame; return {@code false} otherwise. 3799 * @syscap SystemCapability.Web.Webview.Core 3800 * @crossplatform 3801 * @atomicservice 3802 * @since 18 3803 */ 3804 isMainFrame(): boolean; 3805 3806 /** 3807 * Check whether the request redirects. 3808 * 3809 * @returns { boolean } Return {@code true} if the request redirects; return {@code false} otherwise. 3810 * @syscap SystemCapability.Web.Webview.Core 3811 * @since 8 3812 */ 3813 /** 3814 * Check whether the request redirects. 3815 * 3816 * @returns { boolean } Return {@code true} if the request redirects; return {@code false} otherwise. 3817 * @syscap SystemCapability.Web.Webview.Core 3818 * @atomicservice 3819 * @since 11 3820 */ 3821 /** 3822 * Check whether the request redirects. 3823 * 3824 * @returns { boolean } Return {@code true} if the request redirects; return {@code false} otherwise. 3825 * @syscap SystemCapability.Web.Webview.Core 3826 * @crossplatform 3827 * @atomicservice 3828 * @since 18 3829 */ 3830 isRedirect(): boolean; 3831 3832 /** 3833 * Get request method. 3834 * 3835 * @returns { string } Return the request method. 3836 * @syscap SystemCapability.Web.Webview.Core 3837 * @since 9 3838 */ 3839 /** 3840 * Get request method. 3841 * 3842 * @returns { string } Return the request method. 3843 * @syscap SystemCapability.Web.Webview.Core 3844 * @atomicservice 3845 * @since 11 3846 */ 3847 /** 3848 * Get request method. 3849 * 3850 * @returns { string } Return the request method. 3851 * @syscap SystemCapability.Web.Webview.Core 3852 * @crossplatform 3853 * @atomicservice 3854 * @since 18 3855 */ 3856 getRequestMethod(): string; 3857} 3858 3859/** 3860 * Defines the Web resource response. 3861 * 3862 * @syscap SystemCapability.Web.Webview.Core 3863 * @since 8 3864 */ 3865/** 3866 * Defines the Web resource response. 3867 * 3868 * @syscap SystemCapability.Web.Webview.Core 3869 * @crossplatform 3870 * @atomicservice 3871 * @since arkts {'1.1':'11', '1.2':'20'} 3872 * @arkts 1.1&1.2 3873 */ 3874declare class WebResourceResponse { 3875 /** 3876 * Constructor. 3877 * 3878 * @syscap SystemCapability.Web.Webview.Core 3879 * @since 8 3880 */ 3881 /** 3882 * Constructor. 3883 * 3884 * @syscap SystemCapability.Web.Webview.Core 3885 * @crossplatform 3886 * @atomicservice 3887 * @since arkts {'1.1':'11', '1.2':'20'} 3888 * @arkts 1.1&1.2 3889 */ 3890 constructor(); 3891 3892 /** 3893 * Gets the response data. 3894 * 3895 * @returns { string } Return the response data. 3896 * @syscap SystemCapability.Web.Webview.Core 3897 * @since 8 3898 */ 3899 /** 3900 * Gets the response data. 3901 * 3902 * @returns { string } Return the response data. 3903 * @syscap SystemCapability.Web.Webview.Core 3904 * @atomicservice 3905 * @since 11 3906 */ 3907 /** 3908 * Gets the response data. 3909 * 3910 * @returns { string } Return the response data. 3911 * @syscap SystemCapability.Web.Webview.Core 3912 * @crossplatform 3913 * @atomicservice 3914 * @since 18 3915 */ 3916 getResponseData(): string; 3917 3918 /** 3919 * Gets the response data. 3920 * 3921 * @returns { string | number | ArrayBuffer | Resource | undefined } Return the response data. 3922 * string type indicate string in HTML format. 3923 * number type indicate file handle. 3924 * Resource type indicate $rawfile resource. 3925 * ArrayBuffer type indicate binary data. 3926 * @syscap SystemCapability.Web.Webview.Core 3927 * @since 13 3928 */ 3929 /** 3930 * Gets the response data. 3931 * 3932 * @returns { string | number | ArrayBuffer | Resource | undefined } Return the response data. 3933 * string type indicate string in HTML format. 3934 * number type indicate file handle. 3935 * Resource type indicate $rawfile resource. 3936 * ArrayBuffer type indicate binary data. 3937 * @syscap SystemCapability.Web.Webview.Core 3938 * @crossplatform 3939 * @since 18 3940 */ 3941 getResponseDataEx(): string | number | ArrayBuffer | Resource | undefined; 3942 3943 /** 3944 * Gets the response encoding. 3945 * 3946 * @returns { string } Return the response encoding. 3947 * @syscap SystemCapability.Web.Webview.Core 3948 * @since 8 3949 */ 3950 /** 3951 * Gets the response encoding. 3952 * 3953 * @returns { string } Return the response encoding. 3954 * @syscap SystemCapability.Web.Webview.Core 3955 * @crossplatform 3956 * @atomicservice 3957 * @since 11 3958 */ 3959 getResponseEncoding(): string; 3960 3961 /** 3962 * Gets the response MIME type. 3963 * 3964 * @returns { string } Return the response MIME type. 3965 * @syscap SystemCapability.Web.Webview.Core 3966 * @since 8 3967 */ 3968 /** 3969 * Gets the response MIME type. 3970 * 3971 * @returns { string } Return the response MIME type. 3972 * @syscap SystemCapability.Web.Webview.Core 3973 * @crossplatform 3974 * @atomicservice 3975 * @since 11 3976 */ 3977 getResponseMimeType(): string; 3978 3979 /** 3980 * Gets the reason message. 3981 * 3982 * @returns { string } Return the reason message. 3983 * @syscap SystemCapability.Web.Webview.Core 3984 * @since 8 3985 */ 3986 /** 3987 * Gets the reason message. 3988 * 3989 * @returns { string } Return the reason message. 3990 * @syscap SystemCapability.Web.Webview.Core 3991 * @atomicservice 3992 * @since 11 3993 */ 3994 /** 3995 * Gets the reason message. 3996 * 3997 * @returns { string } Return the reason message. 3998 * @syscap SystemCapability.Web.Webview.Core 3999 * @crossplatform 4000 * @atomicservice 4001 * @since 18 4002 */ 4003 getReasonMessage(): string; 4004 4005 /** 4006 * Gets the response headers. 4007 * 4008 * @returns { Array<Header> } Return the response headers. 4009 * @syscap SystemCapability.Web.Webview.Core 4010 * @since 8 4011 */ 4012 /** 4013 * Gets the response headers. 4014 * 4015 * @returns { Array<Header> } Return the response headers. 4016 * @syscap SystemCapability.Web.Webview.Core 4017 * @atomicservice 4018 * @since 11 4019 */ 4020 /** 4021 * Gets the response headers. 4022 * 4023 * @returns { Array<Header> } Return the response headers. 4024 * @syscap SystemCapability.Web.Webview.Core 4025 * @crossplatform 4026 * @atomicservice 4027 * @since 18 4028 */ 4029 getResponseHeader(): Array<Header>; 4030 4031 /** 4032 * Gets the response code. 4033 * 4034 * @returns { number } Return the response code. 4035 * @syscap SystemCapability.Web.Webview.Core 4036 * @since 8 4037 */ 4038 /** 4039 * Gets the response code. 4040 * 4041 * @returns { number } Return the response code. 4042 * @syscap SystemCapability.Web.Webview.Core 4043 * @crossplatform 4044 * @atomicservice 4045 * @since 11 4046 */ 4047 getResponseCode(): number; 4048 4049 /** 4050 * Sets the response data. 4051 * 4052 * @param { string | number | Resource } data - the response data. 4053 * @syscap SystemCapability.Web.Webview.Core 4054 * @since 9 4055 */ 4056 /** 4057 * Sets the response data. 4058 * 4059 * @param { string | number | Resource } data - the response data. 4060 * string type indicate strings in HTML format. 4061 * number type indicate file handle. 4062 * Resource type indicate $rawfile resource. 4063 * @syscap SystemCapability.Web.Webview.Core 4064 * @since 10 4065 */ 4066 /** 4067 * Sets the response data. 4068 * 4069 * @param { string | number | Resource | ArrayBuffer } data - the response data. 4070 * string type indicate strings in HTML format. 4071 * number type indicate file handle. 4072 * Resource type indicate $rawfile resource. 4073 * ArrayBuffer type indicate binary data. 4074 * @syscap SystemCapability.Web.Webview.Core 4075 * @atomicservice 4076 * @since 11 4077 */ 4078 setResponseData(data: string | number | Resource | ArrayBuffer): void; 4079 4080 /** 4081 * Sets the response encoding. 4082 * 4083 * @param { string } encoding the response encoding. 4084 * @syscap SystemCapability.Web.Webview.Core 4085 * @since 9 4086 */ 4087 /** 4088 * Sets the response encoding. 4089 * 4090 * @param { string } encoding the response encoding. 4091 * @syscap SystemCapability.Web.Webview.Core 4092 * @atomicservice 4093 * @since 11 4094 */ 4095 /** 4096 * Sets the response encoding. 4097 * 4098 * @param { string } encoding the response encoding. 4099 * @syscap SystemCapability.Web.Webview.Core 4100 * @atomicservice 4101 * @since 12 4102 */ 4103 setResponseEncoding(encoding: string): void; 4104 4105 /** 4106 * Sets the response MIME type. 4107 * 4108 * @param { string } mimeType the response MIME type. 4109 * @syscap SystemCapability.Web.Webview.Core 4110 * @since 9 4111 */ 4112 /** 4113 * Sets the response MIME type. 4114 * 4115 * @param { string } mimeType the response MIME type. 4116 * @syscap SystemCapability.Web.Webview.Core 4117 * @atomicservice 4118 * @since 11 4119 */ 4120 /** 4121 * Sets the response MIME type. 4122 * 4123 * @param { string } mimeType the response MIME type. 4124 * @syscap SystemCapability.Web.Webview.Core 4125 * @atomicservice 4126 * @since 12 4127 */ 4128 setResponseMimeType(mimeType: string): void; 4129 4130 /** 4131 * Sets the reason message. 4132 * 4133 * @param { string } reason the reason message. 4134 * @syscap SystemCapability.Web.Webview.Core 4135 * @since 9 4136 */ 4137 /** 4138 * Sets the reason message. 4139 * 4140 * @param { string } reason the reason message. 4141 * @syscap SystemCapability.Web.Webview.Core 4142 * @atomicservice 4143 * @since 11 4144 */ 4145 /** 4146 * Sets the reason message. 4147 * 4148 * @param { string } reason the reason message. 4149 * @syscap SystemCapability.Web.Webview.Core 4150 * @atomicservice 4151 * @since 12 4152 */ 4153 setReasonMessage(reason: string): void; 4154 4155 /** 4156 * Sets the response headers. 4157 * 4158 * @param { Array<Header> } header the response headers. 4159 * @syscap SystemCapability.Web.Webview.Core 4160 * @since 9 4161 */ 4162 /** 4163 * Sets the response headers. 4164 * 4165 * @param { Array<Header> } header the response headers. 4166 * @syscap SystemCapability.Web.Webview.Core 4167 * @atomicservice 4168 * @since 11 4169 */ 4170 /** 4171 * Sets the response headers. 4172 * 4173 * @param { Array<Header> } header the response headers. 4174 * @syscap SystemCapability.Web.Webview.Core 4175 * @atomicservice 4176 * @since 12 4177 */ 4178 setResponseHeader(header: Array<Header>): void; 4179 4180 /** 4181 * Sets the response code. 4182 * 4183 * @param { number } code the response code. 4184 * @syscap SystemCapability.Web.Webview.Core 4185 * @since 9 4186 */ 4187 /** 4188 * Sets the response code. 4189 * 4190 * @param { number } code the response code. 4191 * @syscap SystemCapability.Web.Webview.Core 4192 * @atomicservice 4193 * @since 11 4194 */ 4195 /** 4196 * Sets the response code. 4197 * 4198 * @param { number } code the response code. 4199 * @syscap SystemCapability.Web.Webview.Core 4200 * @atomicservice 4201 * @since 12 4202 */ 4203 setResponseCode(code: number): void; 4204 4205 /** 4206 * Sets the response is ready or not. 4207 * 4208 * @param { boolean } IsReady whether the response is ready. 4209 * @syscap SystemCapability.Web.Webview.Core 4210 * @since 9 4211 */ 4212 /** 4213 * Sets the response is ready or not. 4214 * 4215 * @param { boolean } IsReady whether the response is ready. 4216 * @syscap SystemCapability.Web.Webview.Core 4217 * @atomicservice 4218 * @since 11 4219 */ 4220 /** 4221 * Sets the response is ready or not. 4222 * 4223 * @param { boolean } IsReady whether the response is ready. 4224 * @syscap SystemCapability.Web.Webview.Core 4225 * @atomicservice 4226 * @since 12 4227 */ 4228 setResponseIsReady(IsReady: boolean): void; 4229 4230 /** 4231 * Gets whether the response is ready. 4232 * 4233 * @returns { boolean } True indicates the response data is ready and false is not ready. 4234 * @syscap SystemCapability.Web.Webview.Core 4235 * @since 13 4236 */ 4237 /** 4238 * Gets whether the response is ready. 4239 * 4240 * @returns { boolean } True indicates the response data is ready and false is not ready. 4241 * @syscap SystemCapability.Web.Webview.Core 4242 * @crossplatform 4243 * @since 18 4244 */ 4245 getResponseIsReady(): boolean; 4246} 4247 4248/** 4249 * Defines the Web's request/response header. 4250 * 4251 * @interface Header 4252 * @syscap SystemCapability.Web.Webview.Core 4253 * @since 8 4254 */ 4255/** 4256 * Defines the Web's request/response header. 4257 * 4258 * @interface Header 4259 * @syscap SystemCapability.Web.Webview.Core 4260 * @atomicservice 4261 * @since 11 4262 */ 4263/** 4264 * Defines the Web's request/response header. 4265 * 4266 * @typedef Header 4267 * @syscap SystemCapability.Web.Webview.Core 4268 * @atomicservice 4269 * @since 12 4270 */ 4271/** 4272 * Defines the Web's request/response header. 4273 * 4274 * @typedef Header 4275 * @syscap SystemCapability.Web.Webview.Core 4276 * @crossplatform 4277 * @atomicservice 4278 * @since 18 4279 */ 4280declare interface Header { 4281 /** 4282 * Gets the key of the request/response header. 4283 * 4284 * @type { string } 4285 * @syscap SystemCapability.Web.Webview.Core 4286 * @since 8 4287 */ 4288 /** 4289 * Gets the key of the request/response header. 4290 * 4291 * @type { string } 4292 * @syscap SystemCapability.Web.Webview.Core 4293 * @atomicservice 4294 * @since 11 4295 */ 4296 /** 4297 * Gets the key of the request/response header. 4298 * 4299 * @type { string } 4300 * @syscap SystemCapability.Web.Webview.Core 4301 * @crossplatform 4302 * @atomicservice 4303 * @since 18 4304 */ 4305 headerKey: string; 4306 4307 /** 4308 * Gets the value of the request/response header. 4309 * 4310 * @type { string } 4311 * @syscap SystemCapability.Web.Webview.Core 4312 * @since 8 4313 */ 4314 /** 4315 * Gets the value of the request/response header. 4316 * 4317 * @type { string } 4318 * @syscap SystemCapability.Web.Webview.Core 4319 * @atomicservice 4320 * @since 11 4321 */ 4322 /** 4323 * Gets the value of the request/response header. 4324 * 4325 * @type { string } 4326 * @syscap SystemCapability.Web.Webview.Core 4327 * @crossplatform 4328 * @atomicservice 4329 * @since 18 4330 */ 4331 headerValue: string; 4332} 4333 4334/** 4335 * Defines the Web resource error. 4336 * 4337 * @syscap SystemCapability.Web.Webview.Core 4338 * @since 8 4339 */ 4340/** 4341 * Defines the Web resource error. 4342 * 4343 * @syscap SystemCapability.Web.Webview.Core 4344 * @crossplatform 4345 * @since 10 4346 */ 4347/** 4348 * Defines the Web resource error. 4349 * 4350 * @syscap SystemCapability.Web.Webview.Core 4351 * @crossplatform 4352 * @atomicservice 4353 * @since 11 4354 */ 4355declare class WebResourceError { 4356 /** 4357 * Constructor. 4358 * 4359 * @syscap SystemCapability.Web.Webview.Core 4360 * @since 8 4361 */ 4362 /** 4363 * Constructor. 4364 * 4365 * @syscap SystemCapability.Web.Webview.Core 4366 * @crossplatform 4367 * @since 10 4368 */ 4369 /** 4370 * Constructor. 4371 * 4372 * @syscap SystemCapability.Web.Webview.Core 4373 * @crossplatform 4374 * @atomicservice 4375 * @since 11 4376 */ 4377 constructor(); 4378 4379 /** 4380 * Gets the info of the Web resource error. 4381 * 4382 * @returns { string } Return the info of the Web resource error. 4383 * @syscap SystemCapability.Web.Webview.Core 4384 * @since 8 4385 */ 4386 /** 4387 * Gets the info of the Web resource error. 4388 * 4389 * @returns { string } Return the info of the Web resource error. 4390 * @syscap SystemCapability.Web.Webview.Core 4391 * @crossplatform 4392 * @since 10 4393 */ 4394 /** 4395 * Gets the info of the Web resource error. 4396 * 4397 * @returns { string } Return the info of the Web resource error. 4398 * @syscap SystemCapability.Web.Webview.Core 4399 * @crossplatform 4400 * @atomicservice 4401 * @since 11 4402 */ 4403 getErrorInfo(): string; 4404 4405 /** 4406 * Gets the code of the Web resource error. 4407 * 4408 * @returns { number } Return the code of the Web resource error. 4409 * @syscap SystemCapability.Web.Webview.Core 4410 * @since 8 4411 */ 4412 /** 4413 * Gets the code of the Web resource error. 4414 * 4415 * @returns { number } Return the code of the Web resource error. 4416 * @syscap SystemCapability.Web.Webview.Core 4417 * @crossplatform 4418 * @since 10 4419 */ 4420 /** 4421 * Gets the code of the Web resource error. 4422 * 4423 * @returns { number } Return the code of the Web resource error. 4424 * @syscap SystemCapability.Web.Webview.Core 4425 * @crossplatform 4426 * @atomicservice 4427 * @since 11 4428 */ 4429 getErrorCode(): number; 4430} 4431 4432/** 4433 * Defines the js geolocation request. 4434 * 4435 * @syscap SystemCapability.Web.Webview.Core 4436 * @since 8 4437 */ 4438/** 4439 * Defines the js geolocation request. 4440 * 4441 * @syscap SystemCapability.Web.Webview.Core 4442 * @crossplatform 4443 * @atomicservice 4444 * @since arkts {'1.1':'11', '1.2':'20'} 4445 * @arkts 1.1&1.2 4446 */ 4447declare class JsGeolocation { 4448 /** 4449 * Constructor. 4450 * 4451 * @syscap SystemCapability.Web.Webview.Core 4452 * @since 8 4453 */ 4454 /** 4455 * Constructor. 4456 * 4457 * @syscap SystemCapability.Web.Webview.Core 4458 * @crossplatform 4459 * @atomicservice 4460 * @since arkts {'1.1':'11', '1.2':'20'} 4461 * @arkts 1.1&1.2 4462 */ 4463 constructor(); 4464 4465 /** 4466 * Report the geolocation permission status from users. 4467 * 4468 * @param { string } origin - The origin that ask for the geolocation permission. 4469 * @param { boolean } allow - The geolocation permission status. 4470 * @param { boolean } retain - Whether to allow the geolocation permission status to be saved to the system. 4471 * @syscap SystemCapability.Web.Webview.Core 4472 * @since 8 4473 */ 4474 /** 4475 * Sets the geolocation permission status of a web page. 4476 * 4477 * @param { string } origin - Index of the origin. 4478 * @param { boolean } allow - Geolocation permission status. {@code true} means to allow geolocation permission; 4479 * {@code false} means to disallow geolocation permission. 4480 * @param { boolean } retain - Whether the geolocation permission status can be saved to the system. 4481 * {@code true} means to allow the geolocation permission status to be saved to 4482 * the system; {@code false} means to disallow the geolocation permission status to 4483 * be saved to the system. You can manage the geolocation permissions saved 4484 * to the system through {@link GeolocationPermissions}. 4485 * @syscap SystemCapability.Web.Webview.Core 4486 * @crossplatform 4487 * @atomicservice 4488 * @since arkts {'1.1':'11', '1.2':'20'} 4489 * @arkts 1.1&1.2 4490 */ 4491 invoke(origin: string, allow: boolean, retain: boolean): void; 4492} 4493 4494/** 4495 * Defines the Web cookie. 4496 * 4497 * @syscap SystemCapability.Web.Webview.Core 4498 * @since 8 4499 */ 4500/** 4501 * Defines the Web cookie. 4502 * 4503 * @syscap SystemCapability.Web.Webview.Core 4504 * @atomicservice 4505 * @since 11 4506 */ 4507declare class WebCookie { 4508 /** 4509 * Constructor. 4510 * 4511 * @syscap SystemCapability.Web.Webview.Core 4512 * @since 8 4513 */ 4514 /** 4515 * Constructor. 4516 * 4517 * @syscap SystemCapability.Web.Webview.Core 4518 * @atomicservice 4519 * @since 11 4520 */ 4521 constructor(); 4522 4523 /** 4524 * Sets the cookie. 4525 * 4526 * @syscap SystemCapability.Web.Webview.Core 4527 * @since 8 4528 * @deprecated since 9 4529 * @useinstead ohos.web.webview.webview.WebCookieManager#setCookie 4530 */ 4531 setCookie(); 4532 4533 /** 4534 * Saves the cookies. 4535 * 4536 * @syscap SystemCapability.Web.Webview.Core 4537 * @since 8 4538 * @deprecated since 9 4539 * @useinstead ohos.web.webview.webview.WebCookieManager#saveCookieAsync 4540 */ 4541 saveCookie(); 4542} 4543 4544/** 4545 * Represents the event consumption result sent to the Web component. 4546 * For details about the supported events, see TouchEvent/MouseEvent. 4547 * If the application does not consume the event, set this parameter to false, 4548 * and the event will be consumed by the Web component. If the application has consumed the event, 4549 * set this parameter to true, and the event will not be consumed by the Web component. 4550 * 4551 * @syscap SystemCapability.Web.Webview.Core 4552 * @atomicservice 4553 * @since 12 4554 */ 4555declare class EventResult { 4556 /** 4557 * Constructor. 4558 * 4559 * @syscap SystemCapability.Web.Webview.Core 4560 * @atomicservice 4561 * @since 12 4562 */ 4563 constructor(); 4564 4565 /** 4566 * Sets the event consumption result. 4567 * 4568 * @param { boolean } result - Whether to consume the gesture event. 4569 * {@code true} Indicates the consumption of the gesture event. 4570 * {@code false} Indicates the non-consumption of the gesture event. 4571 * Default value: true. 4572 * @syscap SystemCapability.Web.Webview.Core 4573 * @atomicservice 4574 * @since 12 4575 */ 4576 setGestureEventResult(result: boolean): void; 4577 4578 /** 4579 * Sets the gesture event consumption result. 4580 * 4581 * @param { boolean } result - Whether to consume the gesture event. 4582 * {@code true} Indicates the consumption of the gesture event. 4583 * {@code false} Indicates the non-consumption of the gesture event. 4584 * Default value: true. 4585 * @param { boolean } stopPropagation - Whether to stop propagation. 4586 * This parameter is valid only when result is set to true. 4587 * {@code true} Indicates stops the propagation of events farther along. 4588 * {@code false} Indicates the propagation of events farther along. 4589 * Default value: true. 4590 * @syscap SystemCapability.Web.Webview.Core 4591 * @since 14 4592 */ 4593 setGestureEventResult(result: boolean, stopPropagation: boolean): void; 4594 4595 /** 4596 * Sets the mouse event consumption result. 4597 * 4598 * @param { boolean } result - Whether to consume the mouse event. 4599 * {@code true} Indicates the consumption of the mouse event. 4600 * {@code false} Indicates the non-consumption of the mouse event. 4601 * Default value: true. 4602 * @param { boolean } stopPropagation - Whether to stop propagation. 4603 * This parameter is valid only when result is set to true. 4604 * {@code true} Indicates stops the propagation of events farther along. 4605 * {@code false} Indicates the propagation of events farther along. 4606 * Default value: true. 4607 * @syscap SystemCapability.Web.Webview.Core 4608 * @since 20 4609 */ 4610 setMouseEventResult(result: boolean, stopPropagation?: boolean): void; 4611} 4612 4613/** 4614 * Defines the Web controller. 4615 * 4616 * @syscap SystemCapability.Web.Webview.Core 4617 * @since 8 4618 * @deprecated since 9 4619 * @useinstead ohos.web.webview.webview.WebviewController 4620 */ 4621declare class WebController { 4622 /** 4623 * Constructor. 4624 * 4625 * @syscap SystemCapability.Web.Webview.Core 4626 * @since 8 4627 * @deprecated since 9 4628 */ 4629 constructor(); 4630 4631 /** 4632 * Let the Web inactive. 4633 * It is no longer maintained since API version 9, and it is recommended to use {@link onInactive} instead. 4634 * 4635 * @syscap SystemCapability.Web.Webview.Core 4636 * @since 8 4637 * @deprecated since 9 4638 * @useinstead ohos.web.webview.webview.WebviewController#onInactive 4639 */ 4640 onInactive(): void; 4641 4642 /** 4643 * Let the Web active. 4644 * It is no longer maintained since API version 9, and it is recommended to use {@link onActive} instead. 4645 * 4646 * @syscap SystemCapability.Web.Webview.Core 4647 * @since 8 4648 * @deprecated since 9 4649 * @useinstead ohos.web.webview.webview.WebviewController#onActive 4650 */ 4651 onActive(): void; 4652 4653 /** 4654 * Let the Web zoom by. 4655 * 4656 * @param { number } factor The zoom factor. 4657 * @syscap SystemCapability.Web.Webview.Core 4658 * @since 8 4659 * @deprecated since 9 4660 * @useinstead ohos.web.webview.webview.WebviewController#zoom 4661 */ 4662 zoom(factor: number): void; 4663 4664 /** 4665 * Clears the history in the Web. 4666 * 4667 * @syscap SystemCapability.Web.Webview.Core 4668 * @since 8 4669 * @deprecated since 9 4670 * @useinstead ohos.web.webview.webview.WebviewController#clearHistory 4671 */ 4672 clearHistory(): void; 4673 4674 /** 4675 * Asynchronously execute JavaScript in the context of the currently displayed page. 4676 * The result of the script execution will be returned through an asynchronous callback. 4677 * This method must be used on the UI thread, and the callback will also be invoked on the UI thread. 4678 * <p><strong>API Note</strong>:<br> 4679 * The state of JavaScript is no longer persisted across navigations like loadUrl. 4680 * For example, global variables and functions defined before calling loadUrl will not exist in the loaded page. 4681 * It is recommended that applications use registerJavaScriptProxy to ensure that the JavaScript state can be persisted across page navigations. 4682 * <p> 4683 * 4684 * @param { object } options The options with a piece of code and a callback. 4685 * @syscap SystemCapability.Web.Webview.Core 4686 * @since 8 4687 * @deprecated since 9 4688 * @useinstead ohos.web.webview.webview.WebviewController#runJavaScript 4689 */ 4690 runJavaScript(options: { script: string, callback?: (result: string) => void }); 4691 4692 /** 4693 * Loads the data or URL. 4694 * 4695 * @param { object } options The options with the data or URL and other information. 4696 * @syscap SystemCapability.Web.Webview.Core 4697 * @since 8 4698 * @deprecated since 9 4699 * @useinstead ohos.web.webview.webview.WebviewController#loadData 4700 */ 4701 loadData(options: { data: string, mimeType: string, encoding: string, baseUrl?: string, historyUrl?: string }); 4702 4703 /** 4704 * Loads the given URL. 4705 * 4706 * @param { object } options The options with the URL and other information. 4707 * @syscap SystemCapability.Web.Webview.Core 4708 * @since 8 4709 * @deprecated since 9 4710 * @useinstead ohos.web.webview.webview.WebviewController#loadUrl 4711 */ 4712 loadUrl(options: { url: string | Resource, headers?: Array<Header> }); 4713 4714 /** 4715 * refreshes the current URL. 4716 * 4717 * @syscap SystemCapability.Web.Webview.Core 4718 * @since 8 4719 * @deprecated since 9 4720 * @useinstead ohos.web.webview.webview.WebviewController#refresh 4721 */ 4722 refresh(); 4723 4724 /** 4725 * Stops the current load. 4726 * 4727 * @syscap SystemCapability.Web.Webview.Core 4728 * @since 8 4729 * @deprecated since 9 4730 * @useinstead ohos.web.webview.webview.WebviewController#stop 4731 */ 4732 stop(); 4733 4734 /** 4735 * Registers the JavaScript object and method list. 4736 * 4737 * @param { object } options - The option with the JavaScript object and method list. 4738 * @syscap SystemCapability.Web.Webview.Core 4739 * @since 8 4740 * @deprecated since 9 4741 * @useinstead ohos.web.webview.webview.WebviewController#registerJavaScriptProxy 4742 */ 4743 registerJavaScriptProxy(options: { object: object, name: string, methodList: Array<string> }); 4744 4745 /** 4746 * Deletes a registered JavaScript object with given name. 4747 * 4748 * @param { string } name - The name of a registered JavaScript object to be deleted. 4749 * @syscap SystemCapability.Web.Webview.Core 4750 * @since 8 4751 * @deprecated since 9 4752 * @useinstead ohos.web.webview.webview.WebviewController#deleteJavaScriptRegister 4753 */ 4754 deleteJavaScriptRegister(name: string); 4755 4756 /** 4757 * Gets the type of HitTest. 4758 * 4759 * @returns { HitTestType } The type of HitTest. 4760 * @syscap SystemCapability.Web.Webview.Core 4761 * @since 8 4762 * @deprecated since 9 4763 * @useinstead ohos.web.webview.webview.WebviewController#getHitTest 4764 */ 4765 getHitTest(): HitTestType; 4766 4767 /** 4768 * Gets the request focus. 4769 * 4770 * @syscap SystemCapability.Web.Webview.Core 4771 * @since 8 4772 * @deprecated since 9 4773 * @useinstead ohos.web.webview.webview.WebviewController#requestFocus 4774 */ 4775 requestFocus(); 4776 4777 /** 4778 * Checks whether the web page can go back. 4779 * 4780 * @returns { boolean } Whether the web page can go back. 4781 * @syscap SystemCapability.Web.Webview.Core 4782 * @since 8 4783 * @deprecated since 9 4784 * @useinstead ohos.web.webview.webview.WebviewController#accessBackward 4785 */ 4786 accessBackward(): boolean; 4787 4788 /** 4789 * Checks whether the web page can go forward. 4790 * 4791 * @returns { boolean } 4792 * @syscap SystemCapability.Web.Webview.Core 4793 * @since 8 4794 * @deprecated since 9 4795 * @useinstead ohos.web.webview.webview.WebviewController#accessForward 4796 */ 4797 accessForward(): boolean; 4798 4799 /** 4800 * Checks whether the web page can go back or forward the given number of steps. 4801 * 4802 * @param { number } step The number of steps. 4803 * @returns { boolean } 4804 * @syscap SystemCapability.Web.Webview.Core 4805 * @since 8 4806 * @deprecated since 9 4807 * @useinstead ohos.web.webview.webview.WebviewController#accessStep 4808 */ 4809 accessStep(step: number): boolean; 4810 4811 /** 4812 * Goes back in the history of the web page. 4813 * 4814 * @syscap SystemCapability.Web.Webview.Core 4815 * @since 8 4816 * @deprecated since 9 4817 * @useinstead ohos.web.webview.webview.WebviewController#backward 4818 */ 4819 backward(); 4820 4821 /** 4822 * Goes forward in the history of the web page. 4823 * 4824 * @syscap SystemCapability.Web.Webview.Core 4825 * @since 8 4826 * @deprecated since 9 4827 * @useinstead ohos.web.webview.webview.WebviewController#forward 4828 */ 4829 forward(); 4830 4831 /** 4832 * Gets network cookie manager 4833 * 4834 * @returns { WebCookie } 4835 * @syscap SystemCapability.Web.Webview.Core 4836 * @since 9 4837 * @deprecated since 9 4838 * @useinstead ohos.web.webview.WebCookieManager 4839 */ 4840 getCookieManager(): WebCookie; 4841} 4842 4843/** 4844 * Defines the Web options. 4845 * 4846 * @interface WebOptions 4847 * @syscap SystemCapability.Web.Webview.Core 4848 * @since 8 4849 */ 4850/** 4851 * Defines the Web options. 4852 * 4853 * @interface WebOptions 4854 * @syscap SystemCapability.Web.Webview.Core 4855 * @crossplatform 4856 * @since 10 4857 */ 4858/** 4859 * Defines the Web options. 4860 * 4861 * @interface WebOptions 4862 * @syscap SystemCapability.Web.Webview.Core 4863 * @crossplatform 4864 * @atomicservice 4865 * @since 11 4866 */ 4867/** 4868 * Defines the Web options. 4869 * 4870 * @typedef WebOptions 4871 * @syscap SystemCapability.Web.Webview.Core 4872 * @crossplatform 4873 * @atomicservice 4874 * @since arkts {'1.1':'12', '1.2':'20'} 4875 * @arkts 1.1&1.2 4876 */ 4877declare interface WebOptions { 4878 /** 4879 * Sets the address of the web page to be displayed. 4880 * 4881 * @type { string | Resource } 4882 * @syscap SystemCapability.Web.Webview.Core 4883 * @since 8 4884 */ 4885 /** 4886 * Sets the address of the web page to be displayed. 4887 * 4888 * @type { string | Resource } 4889 * @syscap SystemCapability.Web.Webview.Core 4890 * @crossplatform 4891 * @since 10 4892 */ 4893 /** 4894 * Web resource address. If accessing local resource files, please use $rawfile or resource protocol. 4895 * If you load a local resource file that applies the sandbox path outside the package (files support html and txt types), 4896 * please use the file:// sandbox file path. 4897 * Src cannot dynamically change the address through state variables (for example: @State). 4898 * If you need to change it, please reload it through {@link loadUrl}. 4899 * 4900 * @type { string | Resource } 4901 * @syscap SystemCapability.Web.Webview.Core 4902 * @crossplatform 4903 * @atomicservice 4904 * @since arkts {'1.1':'11', '1.2':'20'} 4905 * @arkts 1.1&1.2 4906 */ 4907 src: string | Resource; 4908 4909 /** 4910 * Sets the controller of the Web. 4911 * 4912 * @type { WebController | WebviewController } 4913 * @syscap SystemCapability.Web.Webview.Core 4914 * @since 8 4915 */ 4916 /** 4917 * Sets the controller of the Web. 4918 * 4919 * @type { WebController | WebviewController } 4920 * @syscap SystemCapability.Web.Webview.Core 4921 * @since 9 4922 */ 4923 /** 4924 * Sets the controller of the Web. 4925 * 4926 * @type { WebController | WebviewController } 4927 * @syscap SystemCapability.Web.Webview.Core 4928 * @crossplatform 4929 * @since 10 4930 */ 4931 /** 4932 * Controller, through which you can control various behaviors of Web components 4933 * (including page navigation, declaring cycle state, JavaScript interaction and other behaviors). 4934 * Since API Version 9, WebController is no longer maintained, so it is recommended to use WebviewController instead. 4935 * @type { WebController | WebviewController } 4936 * @syscap SystemCapability.Web.Webview.Core 4937 * @crossplatform 4938 * @atomicservice 4939 * @since 11 4940 */ 4941 controller: WebController | WebviewController; 4942 4943 /** 4944 * Sets the controller of the Web. 4945 * 4946 * @type { WebviewController } 4947 * @syscap SystemCapability.Web.Webview.Core 4948 * @crossplatform 4949 * @since 20 4950 * @arkts 1.2 4951 */ 4952 controller: WebviewController; 4953 4954 /** 4955 * Rendering mode. 4956 * RenderMode.ASYNC_RENDER (default, cannot be dynamically adjusted): The Web component is rendered asynchronously. 4957 * RenderMode.SYNC_RENDER: The Web component is rendered synchronously within the current execution context. 4958 * 4959 * @type { ?RenderMode } 4960 * @syscap SystemCapability.Web.Webview.Core 4961 * @atomicservice 4962 * @since arkts {'1.1':'12', '1.2':'20'} 4963 * @arkts 1.1&1.2 4964 */ 4965 renderMode? : RenderMode; 4966 4967 /** 4968 * Sets the incognito mode of the Web, the parameter is optional and default value is false. 4969 * When the Web is in incognito mode, cookies, records of websites, geolocation permissions 4970 * will not save in persistent files. 4971 * 4972 * @type { ?boolean } 4973 * @syscap SystemCapability.Web.Webview.Core 4974 * @atomicservice 4975 * @since 11 4976 */ 4977 /** 4978 * Sets the incognito mode of the Web, the parameter is optional and default value is false. 4979 * When the Web is in incognito mode, cookies, records of websites, geolocation permissions 4980 * will not save in persistent files. 4981 * 4982 * @type { ?boolean } 4983 * @syscap SystemCapability.Web.Webview.Core 4984 * @crossplatform 4985 * @atomicservice 4986 * @since arkts {'1.1':'18', '1.2':'20'} 4987 * @arkts 1.1&1.2 4988 */ 4989 incognitoMode? : boolean; 4990 4991 /** 4992 * A token indicating that the current Web component specifies a shared rendering process. 4993 * In the multi-rendering process mode, Web components with the same token will preferentially try to reuse 4994 * the rendering process bound to the token. 4995 * The binding of token to the rendering process occurs in the initialization stage of the rendering process. 4996 * When the rendering process has no associated Web component, its binding relationship with token will be removed. 4997 * 4998 * @type { ?string } 4999 * @syscap SystemCapability.Web.Webview.Core 5000 * @since arkts {'1.1':'12', '1.2':'20'} 5001 * @arkts 1.1&1.2 5002 */ 5003 sharedRenderProcessToken? : string; 5004} 5005 5006/** 5007 * Defines the contents of the JavaScript to be injected. 5008 * 5009 * @interface ScriptItem 5010 * @syscap SystemCapability.Web.Webview.Core 5011 * @atomicservice 5012 * @since 11 5013 */ 5014/** 5015 * Defines the contents of the JavaScript to be injected. 5016 * 5017 * @typedef ScriptItem 5018 * @syscap SystemCapability.Web.Webview.Core 5019 * @atomicservice 5020 * @since 12 5021 */ 5022declare interface ScriptItem { 5023 /** 5024 * Sets the JavaScript to be injected. 5025 * 5026 * @type { string } 5027 * @syscap SystemCapability.Web.Webview.Core 5028 * @atomicservice 5029 * @since 11 5030 */ 5031 script: string; 5032 5033 /** 5034 * Sets the rules of the JavaScript. 5035 * 5036 * @type { Array<string> } 5037 * @syscap SystemCapability.Web.Webview.Core 5038 * @atomicservice 5039 * @since 11 5040 */ 5041 scriptRules: Array<string>; 5042} 5043 5044/** 5045 * Defines the load committed details. 5046 * 5047 * @interface LoadCommittedDetails 5048 * @syscap SystemCapability.Web.Webview.Core 5049 * @atomicservice 5050 * @since 11 5051 */ 5052/** 5053 * Defines the load committed details. 5054 * 5055 * @typedef LoadCommittedDetails 5056 * @syscap SystemCapability.Web.Webview.Core 5057 * @atomicservice 5058 * @since 12 5059 */ 5060declare interface LoadCommittedDetails { 5061 /** 5062 * Check whether the request is for getting the main frame. 5063 * 5064 * @type { boolean } 5065 * @syscap SystemCapability.Web.Webview.Core 5066 * @atomicservice 5067 * @since 11 5068 */ 5069 isMainFrame: boolean; 5070 5071 /** 5072 * Whether the navigation happened without changing document. Examples of 5073 * same document navigations are: 5074 * 1. reference fragment navigations. 5075 * 2. pushState/replaceState. 5076 * 3. same page history navigation 5077 * 5078 * @type { boolean } 5079 * @syscap SystemCapability.Web.Webview.Core 5080 * @atomicservice 5081 * @since 11 5082 */ 5083 isSameDocument: boolean; 5084 5085 /** 5086 * True if the committed entry has replaced the existing one. Note that in 5087 * case of subframes, the NavigationEntry and FrameNavigationEntry objects 5088 * don't actually get replaced - they're reused, but with updated attributes. 5089 * 5090 * @type { boolean } 5091 * @syscap SystemCapability.Web.Webview.Core 5092 * @atomicservice 5093 * @since 11 5094 */ 5095 didReplaceEntry: boolean; 5096 5097 /** 5098 * The type of the navigation. 5099 * 5100 * @type { WebNavigationType } 5101 * @syscap SystemCapability.Web.Webview.Core 5102 * @atomicservice 5103 * @since 11 5104 */ 5105 navigationType: WebNavigationType; 5106 5107 /** 5108 * The url to navigate. 5109 * 5110 * @type { string } 5111 * @syscap SystemCapability.Web.Webview.Core 5112 * @atomicservice 5113 * @since 11 5114 */ 5115 url: string; 5116} 5117 5118/** 5119 * Defines the Intelligent Tracking Prevention details. 5120 * 5121 * @typedef IntelligentTrackingPreventionDetails 5122 * @syscap SystemCapability.Web.Webview.Core 5123 * @atomicservice 5124 * @since 12 5125 */ 5126declare interface IntelligentTrackingPreventionDetails { 5127 /** 5128 * The host of website url. 5129 * 5130 * @type { string } 5131 * @syscap SystemCapability.Web.Webview.Core 5132 * @atomicservice 5133 * @since 12 5134 */ 5135 host: string; 5136 5137 /** 5138 * The host of tracker url. 5139 * 5140 * @type { string } 5141 * @syscap SystemCapability.Web.Webview.Core 5142 * @atomicservice 5143 * @since 12 5144 */ 5145 trackerHost: string; 5146} 5147 5148/** 5149 * Defines the Web interface. 5150 * 5151 * @interface WebInterface 5152 * @syscap SystemCapability.Web.Webview.Core 5153 * @since 8 5154 */ 5155/** 5156 * Defines the Web interface. 5157 * 5158 * @interface WebInterface 5159 * @syscap SystemCapability.Web.Webview.Core 5160 * @crossplatform 5161 * @since 10 5162 */ 5163/** 5164 * Defines the Web interface. 5165 * 5166 * @interface WebInterface 5167 * @syscap SystemCapability.Web.Webview.Core 5168 * @crossplatform 5169 * @atomicservice 5170 * @since 11 5171 */ 5172/** 5173 * Defines the Web interface. 5174 * 5175 * @typedef WebInterface 5176 * @syscap SystemCapability.Web.Webview.Core 5177 * @crossplatform 5178 * @atomicservice 5179 * @since arkts {'1.1':'12', '1.2':'20'} 5180 * @arkts 1.1&1.2 5181 */ 5182interface WebInterface { 5183 /** 5184 * Sets Value. 5185 * 5186 * @param { WebOptions } value 5187 * @returns { WebAttribute } 5188 * @syscap SystemCapability.Web.Webview.Core 5189 * @since 8 5190 */ 5191 /** 5192 * Sets Value. 5193 * 5194 * @param { WebOptions } value 5195 * @returns { WebAttribute } 5196 * @syscap SystemCapability.Web.Webview.Core 5197 * @crossplatform 5198 * @since 10 5199 */ 5200 /** 5201 * Sets Value. 5202 * 5203 * @param { WebOptions } value 5204 * @returns { WebAttribute } 5205 * @syscap SystemCapability.Web.Webview.Core 5206 * @crossplatform 5207 * @atomicservice 5208 * @since arkts {'1.1':'11', '1.2':'20'} 5209 * @arkts 1.1&1.2 5210 */ 5211 (value: WebOptions): WebAttribute; 5212} 5213 5214/** 5215 * Defines the embed info. 5216 * 5217 * @interface NativeEmbedInfo 5218 * @syscap SystemCapability.Web.Webview.Core 5219 * @atomicservice 5220 * @since 11 5221 */ 5222/** 5223 * Defines the embed info. 5224 * 5225 * @typedef NativeEmbedInfo 5226 * @syscap SystemCapability.Web.Webview.Core 5227 * @atomicservice 5228 * @since 12 5229 */ 5230declare interface NativeEmbedInfo { 5231 /** 5232 * The embed id. 5233 * 5234 * @type { ?string } 5235 * @syscap SystemCapability.Web.Webview.Core 5236 * @atomicservice 5237 * @since 11 5238 */ 5239 id?: string; 5240 5241 /** 5242 * Only when enableEmbedMode is true and type is marked as native/xxx will be recognized as a same layer component. 5243 * 5244 * @type { ?string } 5245 * @syscap SystemCapability.Web.Webview.Core 5246 * @atomicservice 5247 * @since 11 5248 */ 5249 type?: string; 5250 5251 /** 5252 * The embed tag src. 5253 * 5254 * @type { ?string } 5255 * @syscap SystemCapability.Web.Webview.Core 5256 * @atomicservice 5257 * @since 11 5258 */ 5259 src?: string; 5260 5261 /** 5262 * The coordinate position of embed element relative to the webComponent. 5263 * 5264 * @type { ?Position } 5265 * @syscap SystemCapability.Web.Webview.Core 5266 * @atomicservice 5267 * @since 12 5268 */ 5269 position?: Position; 5270 5271 /** 5272 * The embed tag width. 5273 * 5274 * @type { ?number } 5275 * @syscap SystemCapability.Web.Webview.Core 5276 * @atomicservice 5277 * @since 11 5278 */ 5279 width?: number; 5280 5281 /** 5282 * The embed tag height. 5283 * 5284 * @type { ?number } 5285 * @syscap SystemCapability.Web.Webview.Core 5286 * @atomicservice 5287 * @since 11 5288 */ 5289 height?: number; 5290 5291 /** 5292 * The embed tag url. 5293 * 5294 * @type { ?string } 5295 * @syscap SystemCapability.Web.Webview.Core 5296 * @atomicservice 5297 * @since 11 5298 */ 5299 url?: string; 5300 5301 /** 5302 * The embed tag name. 5303 * 5304 * @type { ?string } 5305 * @syscap SystemCapability.Web.Webview.Core 5306 * @atomicservice 5307 * @since 12 5308 */ 5309 tag?: string; 5310 5311 /** 5312 * The embed param list information used by object tag. 5313 * 5314 * @type { ?Map<string, string> } 5315 * @syscap SystemCapability.Web.Webview.Core 5316 * @atomicservice 5317 * @since 12 5318 */ 5319 params?: Map<string, string>; 5320} 5321 5322/** 5323 * Defines the Embed Data info. 5324 * 5325 * @interface NativeEmbedDataInfo 5326 * @syscap SystemCapability.Web.Webview.Core 5327 * @atomicservice 5328 * @since 11 5329 */ 5330/** 5331 * Defines the Embed Data info. 5332 * 5333 * @typedef NativeEmbedDataInfo 5334 * @syscap SystemCapability.Web.Webview.Core 5335 * @atomicservice 5336 * @since 12 5337 */ 5338declare interface NativeEmbedDataInfo { 5339 /** 5340 * The embed status. 5341 * 5342 * @type { ?NativeEmbedStatus } 5343 * @syscap SystemCapability.Web.Webview.Core 5344 * @atomicservice 5345 * @since 11 5346 */ 5347 status?: NativeEmbedStatus; 5348 5349 /** 5350 * The surface id. 5351 * 5352 * @type { ?string } 5353 * @syscap SystemCapability.Web.Webview.Core 5354 * @atomicservice 5355 * @since 11 5356 */ 5357 surfaceId?: string; 5358 5359 /** 5360 * The embed id. 5361 * 5362 * @type { ?string } 5363 * @syscap SystemCapability.Web.Webview.Core 5364 * @atomicservice 5365 * @since 11 5366 */ 5367 embedId?: string; 5368 5369 /** 5370 * The embed info. 5371 * 5372 * @type { ?NativeEmbedInfo } 5373 * @syscap SystemCapability.Web.Webview.Core 5374 * @atomicservice 5375 * @since 11 5376 */ 5377 info?: NativeEmbedInfo; 5378} 5379 5380/** 5381 * Defines the Embed Visibility info. 5382 * 5383 * @typedef NativeEmbedVisibilityInfo 5384 * @syscap SystemCapability.Web.Webview.Core 5385 * @since 12 5386 */ 5387declare interface NativeEmbedVisibilityInfo { 5388 /** 5389 * The embed visibility. 5390 * 5391 * @type { boolean } 5392 * @syscap SystemCapability.Web.Webview.Core 5393 * @since 12 5394 */ 5395 visibility: boolean; 5396 5397 /** 5398 * The embed id. 5399 * 5400 * @type { string } 5401 * @syscap SystemCapability.Web.Webview.Core 5402 * @since 12 5403 */ 5404 embedId: string; 5405} 5406 5407/** 5408 * Defines the user touch info. 5409 * 5410 * @interface NativeEmbedTouchInfo 5411 * @syscap SystemCapability.Web.Webview.Core 5412 * @atomicservice 5413 * @since 11 5414 */ 5415/** 5416 * Defines the user touch info. 5417 * 5418 * @typedef NativeEmbedTouchInfo 5419 * @syscap SystemCapability.Web.Webview.Core 5420 * @atomicservice 5421 * @since 12 5422 */ 5423declare interface NativeEmbedTouchInfo { 5424 /** 5425 * The native embed id. 5426 * 5427 * @type { ?string } 5428 * @syscap SystemCapability.Web.Webview.Core 5429 * @atomicservice 5430 * @since 11 5431 */ 5432 embedId?: string; 5433 5434 /** 5435 * An event sent when the state of contacts with a touch-sensitive surface changes. 5436 * 5437 * @type { ?TouchEvent } 5438 * @syscap SystemCapability.Web.Webview.Core 5439 * @atomicservice 5440 * @since 11 5441 */ 5442 touchEvent?: TouchEvent; 5443 5444 /** 5445 * Handle the user's touch result. 5446 * 5447 * @type { ?EventResult } 5448 * @syscap SystemCapability.Web.Webview.Core 5449 * @atomicservice 5450 * @since 12 5451 */ 5452 result?: EventResult; 5453} 5454 5455/** 5456 * Defines the user mouse info on embed layer. 5457 * 5458 * @typedef NativeEmbedMouseInfo 5459 * @syscap SystemCapability.Web.Webview.Core 5460 * @since 20 5461 */ 5462declare interface NativeEmbedMouseInfo { 5463 /** 5464 * The native embed id. 5465 * 5466 * @type { ?string } 5467 * @syscap SystemCapability.Web.Webview.Core 5468 * @since 20 5469 */ 5470 embedId?: string; 5471 5472 /** 5473 * An event sent when the state of contacts with a mouse-sensitive surface changes. 5474 * 5475 * @type { ?MouseEvent } 5476 * @syscap SystemCapability.Web.Webview.Core 5477 * @since 20 5478 */ 5479 mouseEvent?: MouseEvent; 5480 5481 /** 5482 * Handle the user's mouse result. 5483 * 5484 * @type { ?EventResult } 5485 * @syscap SystemCapability.Web.Webview.Core 5486 * @since 20 5487 */ 5488 result?: EventResult; 5489} 5490 5491/** 5492 * Defines the first content paint rendering of web page. 5493 * 5494 * @typedef FirstMeaningfulPaint 5495 * @syscap SystemCapability.Web.Webview.Core 5496 * @atomicservice 5497 * @since 12 5498 */ 5499declare interface FirstMeaningfulPaint { 5500 /** 5501 * Start time of navigation. 5502 * 5503 * @type { ?number } 5504 * @syscap SystemCapability.Web.Webview.Core 5505 * @atomicservice 5506 * @since 12 5507 */ 5508 navigationStartTime?: number; 5509 5510 /** 5511 * Paint time of first meaningful content. 5512 * 5513 * @type { ?number } 5514 * @syscap SystemCapability.Web.Webview.Core 5515 * @atomicservice 5516 * @since 12 5517 */ 5518 firstMeaningfulPaintTime?: number; 5519} 5520 5521/** 5522 * Defines the largest content paint rendering of web page. 5523 * 5524 * @typedef LargestContentfulPaint 5525 * @syscap SystemCapability.Web.Webview.Core 5526 * @atomicservice 5527 * @since 12 5528 */ 5529declare interface LargestContentfulPaint { 5530 /** 5531 * Start time of navigation. 5532 * 5533 * @type { ?number } 5534 * @syscap SystemCapability.Web.Webview.Core 5535 * @atomicservice 5536 * @since 12 5537 */ 5538 navigationStartTime?: number; 5539 5540 /** 5541 * Paint time of largest image. 5542 * 5543 * @type { ?number } 5544 * @syscap SystemCapability.Web.Webview.Core 5545 * @atomicservice 5546 * @since 12 5547 */ 5548 largestImagePaintTime?: number; 5549 5550 /** 5551 * Paint time of largest text. 5552 * 5553 * @type { ?number } 5554 * @syscap SystemCapability.Web.Webview.Core 5555 * @atomicservice 5556 * @since 12 5557 */ 5558 largestTextPaintTime?: number; 5559 5560 /** 5561 * Bits per pixel of image. 5562 * 5563 * @type { ?number } 5564 * @syscap SystemCapability.Web.Webview.Core 5565 * @atomicservice 5566 * @since 12 5567 */ 5568 imageBPP?: number; 5569 5570 /** 5571 * Load start time of largest image. 5572 * 5573 * @type { ?number } 5574 * @syscap SystemCapability.Web.Webview.Core 5575 * @atomicservice 5576 * @since 12 5577 */ 5578 largestImageLoadStartTime?: number; 5579 5580 /** 5581 * Load end time of largest image. 5582 * 5583 * @type { ?number } 5584 * @syscap SystemCapability.Web.Webview.Core 5585 * @atomicservice 5586 * @since 12 5587 */ 5588 largestImageLoadEndTime?: number; 5589} 5590 5591/** 5592 * Defines the render process not responding info. 5593 * 5594 * @interface RenderProcessNotRespondingData 5595 * @syscap SystemCapability.Web.Webview.Core 5596 * @since 12 5597 */ 5598declare interface RenderProcessNotRespondingData { 5599 /** 5600 * JavaScript stack info of the webpage when render process not responding. 5601 * 5602 * @type { string } 5603 * @syscap SystemCapability.Web.Webview.Core 5604 * @since 12 5605 */ 5606 jsStack: string; 5607 5608 /** 5609 * Process id of render process not responding. 5610 * 5611 * @type { number } 5612 * @syscap SystemCapability.Web.Webview.Core 5613 * @since 12 5614 */ 5615 pid: number; 5616 5617 /** 5618 * Reason for the render process not responding. 5619 * 5620 * @type { RenderProcessNotRespondingReason } 5621 * @syscap SystemCapability.Web.Webview.Core 5622 * @since 12 5623 */ 5624 reason: RenderProcessNotRespondingReason; 5625} 5626 5627/** 5628 * Defines the triggered function at the end of web page loading. 5629 * 5630 * @typedef OnPageEndEvent 5631 * @syscap SystemCapability.Web.Webview.Core 5632 * @crossplatform 5633 * @atomicservice 5634 * @since arkts {'1.1':'12', '1.2':'20'} 5635 * @arkts 1.1&1.2 5636 */ 5637declare interface OnPageEndEvent { 5638 /** 5639 * The url of page. 5640 * 5641 * @type { string } 5642 * @syscap SystemCapability.Web.Webview.Core 5643 * @crossplatform 5644 * @atomicservice 5645 * @since arkts {'1.1':'12', '1.2':'20'} 5646 * @arkts 1.1&1.2 5647 */ 5648 url: string; 5649} 5650 5651/** 5652 * Defines the triggered function at the begin of web page loading. 5653 * 5654 * @typedef OnPageBeginEvent 5655 * @syscap SystemCapability.Web.Webview.Core 5656 * @crossplatform 5657 * @atomicservice 5658 * @since arkts {'1.1':'12', '1.2':'20'} 5659 * @arkts 1.1&1.2 5660 */ 5661declare interface OnPageBeginEvent { 5662 /** 5663 * The url of page. 5664 * 5665 * @type { string } 5666 * @syscap SystemCapability.Web.Webview.Core 5667 * @crossplatform 5668 * @atomicservice 5669 * @since arkts {'1.1':'12', '1.2':'20'} 5670 * @arkts 1.1&1.2 5671 */ 5672 url: string; 5673} 5674 5675/** 5676 * Defines the triggered function at the begin of web page loading. 5677 * 5678 * @typedef OnLoadStartedEvent 5679 * @syscap SystemCapability.Web.Webview.Core 5680 * @since 20 5681 */ 5682declare interface OnLoadStartedEvent { 5683 /** 5684 * The url to be loaded. 5685 * 5686 * @type { string } 5687 * @syscap SystemCapability.Web.Webview.Core 5688 * @since 20 5689 */ 5690 url: string; 5691} 5692 5693/** 5694 * Defines the triggered function at the end of web page loading. 5695 * 5696 * @typedef OnLoadFinishedEvent 5697 * @syscap SystemCapability.Web.Webview.Core 5698 * @since 20 5699 */ 5700declare interface OnLoadFinishedEvent { 5701 /** 5702 * The url to be loaded. 5703 * 5704 * @type { string } 5705 * @syscap SystemCapability.Web.Webview.Core 5706 * @since 20 5707 */ 5708 url: string; 5709} 5710 5711/** 5712 * Defines the triggered function when the page loading progress changes. 5713 * 5714 * @typedef OnProgressChangeEvent 5715 * @syscap SystemCapability.Web.Webview.Core 5716 * @crossplatform 5717 * @atomicservice 5718 * @since arkts {'1.1':'12', '1.2':'20'} 5719 * @arkts 1.1&1.2 5720 */ 5721declare interface OnProgressChangeEvent { 5722 /** 5723 * The new progress of the page. 5724 * 5725 * @type { number } 5726 * @syscap SystemCapability.Web.Webview.Core 5727 * @crossplatform 5728 * @atomicservice 5729 * @since arkts {'1.1':'12', '1.2':'20'} 5730 * @arkts 1.1&1.2 5731 */ 5732 newProgress: number; 5733} 5734 5735/** 5736 * Defines the triggered function when the title of the main application document changes. 5737 * 5738 * @typedef OnTitleReceiveEvent 5739 * @syscap SystemCapability.Web.Webview.Core 5740 * @crossplatform 5741 * @atomicservice 5742 * @since 12 5743 */ 5744declare interface OnTitleReceiveEvent { 5745 /** 5746 * The title of the page. 5747 * 5748 * @type { string } 5749 * @syscap SystemCapability.Web.Webview.Core 5750 * @crossplatform 5751 * @atomicservice 5752 * @since 12 5753 */ 5754 title: string; 5755 5756 /** 5757 * Mark the source of the title. If it is true, the title is derived from the H5 title element; 5758 * If it is false, it is calculated from the URL. By default, it is calculated from the URL. 5759 * 5760 * @type { ?boolean } 5761 * @syscap SystemCapability.Web.Webview.Core 5762 * @since 20 5763 */ 5764 isRealTitle?: boolean; 5765} 5766 5767/** 5768 * Defines the triggered function when requesting to show the geolocation permission. 5769 * 5770 * @typedef OnGeolocationShowEvent 5771 * @syscap SystemCapability.Web.Webview.Core 5772 * @crossplatform 5773 * @atomicservice 5774 * @since arkts {'1.1':'12', '1.2':'20'} 5775 * @arkts 1.1&1.2 5776 */ 5777declare interface OnGeolocationShowEvent { 5778 /** 5779 * Origin of the page. 5780 * 5781 * @type { string } 5782 * @syscap SystemCapability.Web.Webview.Core 5783 * @crossplatform 5784 * @atomicservice 5785 * @since arkts {'1.1':'12', '1.2':'20'} 5786 * @arkts 1.1&1.2 5787 */ 5788 origin: string; 5789 5790 /** 5791 * Defines the js geolocation request. 5792 * 5793 * @type { JsGeolocation } 5794 * @syscap SystemCapability.Web.Webview.Core 5795 * @crossplatform 5796 * @atomicservice 5797 * @since arkts {'1.1':'12', '1.2':'20'} 5798 * @arkts 1.1&1.2 5799 */ 5800 geolocation: JsGeolocation; 5801} 5802 5803/** 5804 * Defines the triggered function when the web page wants to display a JavaScript alert() dialog. 5805 * 5806 * @typedef OnAlertEvent 5807 * @syscap SystemCapability.Web.Webview.Core 5808 * @crossplatform 5809 * @atomicservice 5810 * @since 12 5811 */ 5812declare interface OnAlertEvent { 5813 /** 5814 * The url of the page. 5815 * 5816 * @type { string } 5817 * @syscap SystemCapability.Web.Webview.Core 5818 * @crossplatform 5819 * @atomicservice 5820 * @since 12 5821 */ 5822 url: string; 5823 5824 /** 5825 * The message of alert dialog. 5826 * 5827 * @type { string } 5828 * @syscap SystemCapability.Web.Webview.Core 5829 * @crossplatform 5830 * @atomicservice 5831 * @since 12 5832 */ 5833 message: string; 5834 5835 /** 5836 * Handle the user's JavaScript result. 5837 * 5838 * @type { JsResult } 5839 * @syscap SystemCapability.Web.Webview.Core 5840 * @crossplatform 5841 * @atomicservice 5842 * @since 12 5843 */ 5844 result: JsResult; 5845} 5846 5847/** 5848 * Defines the triggered function when the web page wants to confirm navigation from JavaScript onbeforeunload. 5849 * 5850 * @typedef OnBeforeUnloadEvent 5851 * @syscap SystemCapability.Web.Webview.Core 5852 * @atomicservice 5853 * @since 12 5854 */ 5855/** 5856 * Defines the triggered function when the web page wants to confirm navigation from JavaScript onbeforeunload. 5857 * 5858 * @typedef OnBeforeUnloadEvent 5859 * @syscap SystemCapability.Web.Webview.Core 5860 * @crossplatform 5861 * @atomicservice 5862 * @since 18 5863 */ 5864declare interface OnBeforeUnloadEvent { 5865 /** 5866 * The url of the page. 5867 * 5868 * @type { string } 5869 * @syscap SystemCapability.Web.Webview.Core 5870 * @atomicservice 5871 * @since 12 5872 */ 5873 /** 5874 * The url of the page. 5875 * 5876 * @type { string } 5877 * @syscap SystemCapability.Web.Webview.Core 5878 * @crossplatform 5879 * @atomicservice 5880 * @since 18 5881 */ 5882 url: string; 5883 5884 /** 5885 * The message of confirm dialog. 5886 * 5887 * @type { string } 5888 * @syscap SystemCapability.Web.Webview.Core 5889 * @atomicservice 5890 * @since 12 5891 */ 5892 /** 5893 * The message of confirm dialog. 5894 * 5895 * @type { string } 5896 * @syscap SystemCapability.Web.Webview.Core 5897 * @crossplatform 5898 * @atomicservice 5899 * @since 18 5900 */ 5901 message: string; 5902 5903 /** 5904 * Handle the user's JavaScript result. 5905 * 5906 * @type { JsResult } 5907 * @syscap SystemCapability.Web.Webview.Core 5908 * @atomicservice 5909 * @since 12 5910 */ 5911 /** 5912 * Handle the user's JavaScript result. 5913 * 5914 * @type { JsResult } 5915 * @syscap SystemCapability.Web.Webview.Core 5916 * @crossplatform 5917 * @atomicservice 5918 * @since 18 5919 */ 5920 result: JsResult; 5921 5922 /** 5923 * The isReload parameter is set to true when the page is refreshed; 5924 * otherwise, it remains false. Default is false. 5925 * 5926 * @type { ?boolean } 5927 * @syscap SystemCapability.Web.Webview.Core 5928 * @since 20 5929 */ 5930 isReload?: boolean; 5931} 5932 5933/** 5934 * Defines the triggered function when the web page wants to display a JavaScript confirm() dialog. 5935 * 5936 * @typedef OnConfirmEvent 5937 * @syscap SystemCapability.Web.Webview.Core 5938 * @crossplatform 5939 * @atomicservice 5940 * @since arkts {'1.1':'12', '1.2':'20'} 5941 * @arkts 1.1&1.2 5942 */ 5943declare interface OnConfirmEvent { 5944 /** 5945 * The url of the page. 5946 * 5947 * @type { string } 5948 * @syscap SystemCapability.Web.Webview.Core 5949 * @crossplatform 5950 * @atomicservice 5951 * @since arkts {'1.1':'12', '1.2':'20'} 5952 * @arkts 1.1&1.2 5953 */ 5954 url: string; 5955 5956 /** 5957 * The message of confirm dialog. 5958 * 5959 * @type { string } 5960 * @syscap SystemCapability.Web.Webview.Core 5961 * @crossplatform 5962 * @atomicservice 5963 * @since arkts {'1.1':'12', '1.2':'20'} 5964 * @arkts 1.1&1.2 5965 */ 5966 message: string; 5967 5968 /** 5969 * Handle the user's JavaScript result. 5970 * 5971 * @type { JsResult } 5972 * @syscap SystemCapability.Web.Webview.Core 5973 * @crossplatform 5974 * @atomicservice 5975 * @since arkts {'1.1':'12', '1.2':'20'} 5976 * @arkts 1.1&1.2 5977 */ 5978 result: JsResult; 5979} 5980 5981/** 5982 * Defines the triggered function when the web page wants to display a JavaScript prompt() dialog. 5983 * 5984 * @typedef OnPromptEvent 5985 * @syscap SystemCapability.Web.Webview.Core 5986 * @crossplatform 5987 * @atomicservice 5988 * @since arkts {'1.1':'12', '1.2':'20'} 5989 * @arkts 1.1&1.2 5990 */ 5991declare interface OnPromptEvent { 5992 /** 5993 * The url of the page. 5994 * 5995 * @type { string } 5996 * @syscap SystemCapability.Web.Webview.Core 5997 * @crossplatform 5998 * @atomicservice 5999 * @since arkts {'1.1':'12', '1.2':'20'} 6000 * @arkts 1.1&1.2 6001 */ 6002 url: string; 6003 6004 /** 6005 * The message of prompt dialog. 6006 * 6007 * @type { string } 6008 * @syscap SystemCapability.Web.Webview.Core 6009 * @crossplatform 6010 * @atomicservice 6011 * @since arkts {'1.1':'12', '1.2':'20'} 6012 * @arkts 1.1&1.2 6013 */ 6014 message: string; 6015 6016 /** 6017 * The value of prompt dialog. 6018 * 6019 * @type { string } 6020 * @syscap SystemCapability.Web.Webview.Core 6021 * @crossplatform 6022 * @atomicservice 6023 * @since arkts {'1.1':'12', '1.2':'20'} 6024 * @arkts 1.1&1.2 6025 */ 6026 value: string; 6027 6028 /** 6029 * Handle the user's JavaScript result. 6030 * 6031 * @type { JsResult } 6032 * @syscap SystemCapability.Web.Webview.Core 6033 * @crossplatform 6034 * @atomicservice 6035 * @since arkts {'1.1':'12', '1.2':'20'} 6036 * @arkts 1.1&1.2 6037 */ 6038 result: JsResult; 6039} 6040 6041/** 6042 * Defines the triggered function when the web page receives a JavaScript console message. 6043 * 6044 * @typedef OnConsoleEvent 6045 * @syscap SystemCapability.Web.Webview.Core 6046 * @crossplatform 6047 * @atomicservice 6048 * @since 12 6049 */ 6050declare interface OnConsoleEvent { 6051 /** 6052 * Console message information of the event. 6053 * 6054 * @type { ConsoleMessage } 6055 * @syscap SystemCapability.Web.Webview.Core 6056 * @crossplatform 6057 * @atomicservice 6058 * @since 12 6059 */ 6060 message: ConsoleMessage; 6061} 6062 6063/** 6064 * Defines the triggered function when the web page receives a web resource loading error. 6065 * 6066 * @typedef OnErrorReceiveEvent 6067 * @syscap SystemCapability.Web.Webview.Core 6068 * @crossplatform 6069 * @atomicservice 6070 * @since 12 6071 */ 6072declare interface OnErrorReceiveEvent { 6073 /** 6074 * The information of request. 6075 * 6076 * @type { WebResourceRequest } 6077 * @syscap SystemCapability.Web.Webview.Core 6078 * @crossplatform 6079 * @atomicservice 6080 * @since 12 6081 */ 6082 request: WebResourceRequest; 6083 6084 /** 6085 * The information of error. 6086 * 6087 * @type { WebResourceError } 6088 * @syscap SystemCapability.Web.Webview.Core 6089 * @crossplatform 6090 * @atomicservice 6091 * @since 12 6092 */ 6093 error: WebResourceError; 6094} 6095 6096/** 6097 * Defines the triggered function when the web page receives a web resource loading HTTP error. 6098 * 6099 * @typedef OnHttpErrorReceiveEvent 6100 * @syscap SystemCapability.Web.Webview.Core 6101 * @crossplatform 6102 * @atomicservice 6103 * @since 12 6104 */ 6105declare interface OnHttpErrorReceiveEvent { 6106 /** 6107 * The information of request. 6108 * 6109 * @type { WebResourceRequest } 6110 * @syscap SystemCapability.Web.Webview.Core 6111 * @crossplatform 6112 * @atomicservice 6113 * @since 12 6114 */ 6115 request: WebResourceRequest; 6116 6117 /** 6118 * Web resource response of event. 6119 * 6120 * @type { WebResourceResponse } 6121 * @syscap SystemCapability.Web.Webview.Core 6122 * @crossplatform 6123 * @atomicservice 6124 * @since 12 6125 */ 6126 response: WebResourceResponse; 6127} 6128 6129/** 6130 * Defines the triggered function when starting to download. 6131 * 6132 * @typedef OnDownloadStartEvent 6133 * @syscap SystemCapability.Web.Webview.Core 6134 * @crossplatform 6135 * @atomicservice 6136 * @since 12 6137 */ 6138declare interface OnDownloadStartEvent { 6139 /** 6140 * The URL of page. 6141 * 6142 * @type { string } 6143 * @syscap SystemCapability.Web.Webview.Core 6144 * @crossplatform 6145 * @atomicservice 6146 * @since 12 6147 */ 6148 url: string; 6149 6150 /** 6151 * The userAgent of page. 6152 * 6153 * @type { string } 6154 * @syscap SystemCapability.Web.Webview.Core 6155 * @crossplatform 6156 * @atomicservice 6157 * @since 12 6158 */ 6159 userAgent: string; 6160 6161 /** 6162 * The contentDisposition of page. 6163 * 6164 * @type { string } 6165 * @syscap SystemCapability.Web.Webview.Core 6166 * @atomicservice 6167 * @since 12 6168 */ 6169 /** 6170 * The contentDisposition of page. 6171 * 6172 * @type { string } 6173 * @syscap SystemCapability.Web.Webview.Core 6174 * @crossplatform 6175 * @atomicservice 6176 * @since 18 6177 */ 6178 contentDisposition: string; 6179 6180 /** 6181 * The mimetype of page. 6182 * 6183 * @type { string } 6184 * @syscap SystemCapability.Web.Webview.Core 6185 * @crossplatform 6186 * @atomicservice 6187 * @since 12 6188 */ 6189 mimetype: string; 6190 6191 /** 6192 * The contentLength of page. 6193 * 6194 * @type { number } 6195 * @syscap SystemCapability.Web.Webview.Core 6196 * @crossplatform 6197 * @atomicservice 6198 * @since 12 6199 */ 6200 contentLength: number; 6201} 6202 6203/** 6204 * Defines the triggered callback when the Web page refreshes accessed history. 6205 * 6206 * @typedef OnRefreshAccessedHistoryEvent 6207 * @syscap SystemCapability.Web.Webview.Core 6208 * @atomicservice 6209 * @since 12 6210 */ 6211/** 6212 * Defines the triggered callback when the Web page refreshes accessed history. 6213 * 6214 * @typedef OnRefreshAccessedHistoryEvent 6215 * @syscap SystemCapability.Web.Webview.Core 6216 * @crossplatform 6217 * @atomicservice 6218 * @since 18 6219 */ 6220declare interface OnRefreshAccessedHistoryEvent { 6221 /** 6222 * URL of the visit. 6223 * 6224 * @type { string } 6225 * @syscap SystemCapability.Web.Webview.Core 6226 * @atomicservice 6227 * @since 12 6228 */ 6229 /** 6230 * URL of the visit. 6231 * 6232 * @type { string } 6233 * @syscap SystemCapability.Web.Webview.Core 6234 * @crossplatform 6235 * @atomicservice 6236 * @since 18 6237 */ 6238 url: string; 6239 6240 /** 6241 * If true, the page is being reloaded, otherwise, means that the page is newly loaded. 6242 * 6243 * @type { boolean } 6244 * @syscap SystemCapability.Web.Webview.Core 6245 * @atomicservice 6246 * @since 12 6247 */ 6248 /** 6249 * If true, the page is being reloaded, otherwise, means that the page is newly loaded. 6250 * 6251 * @type { boolean } 6252 * @syscap SystemCapability.Web.Webview.Core 6253 * @crossplatform 6254 * @atomicservice 6255 * @since 18 6256 */ 6257 isRefreshed: boolean; 6258} 6259 6260/** 6261 * Defines the triggered when the render process exits. 6262 * 6263 * @typedef OnRenderExitedEvent 6264 * @syscap SystemCapability.Web.Webview.Core 6265 * @atomicservice 6266 * @since 12 6267 */ 6268declare interface OnRenderExitedEvent { 6269 /** 6270 * The specific reason why the rendering process exits abnormally. 6271 * 6272 * @type { RenderExitReason } 6273 * @syscap SystemCapability.Web.Webview.Core 6274 * @atomicservice 6275 * @since 12 6276 */ 6277 renderExitReason: RenderExitReason; 6278} 6279 6280/** 6281 * Defines the triggered when the file selector shows. 6282 * 6283 * @typedef OnShowFileSelectorEvent 6284 * @syscap SystemCapability.Web.Webview.Core 6285 * @crossplatform 6286 * @atomicservice 6287 * @since arkts {'1.1':'12', '1.2':'20'} 6288 * @arkts 1.1&1.2 6289 */ 6290declare interface OnShowFileSelectorEvent { 6291 /** 6292 * Defines the file selector result. 6293 * 6294 * @type { FileSelectorResult } 6295 * @syscap SystemCapability.Web.Webview.Core 6296 * @crossplatform 6297 * @atomicservice 6298 * @since arkts {'1.1':'12', '1.2':'20'} 6299 * @arkts 1.1&1.2 6300 */ 6301 result: FileSelectorResult; 6302 6303 /** 6304 * Encompassed message information as parameters to fileSelector. 6305 * 6306 * @type { FileSelectorParam } 6307 * @syscap SystemCapability.Web.Webview.Core 6308 * @crossplatform 6309 * @atomicservice 6310 * @since arkts {'1.1':'12', '1.2':'20'} 6311 * @arkts 1.1&1.2 6312 */ 6313 fileSelector: FileSelectorParam; 6314} 6315 6316/** 6317 * Defines the triggered when the url loading. 6318 * 6319 * @typedef OnResourceLoadEvent 6320 * @syscap SystemCapability.Web.Webview.Core 6321 * @atomicservice 6322 * @since 12 6323 */ 6324declare interface OnResourceLoadEvent { 6325 /** 6326 * The URL of the loaded resource file. 6327 * 6328 * @type { string } 6329 * @syscap SystemCapability.Web.Webview.Core 6330 * @atomicservice 6331 * @since 12 6332 */ 6333 url: string; 6334} 6335 6336/** 6337 * Defines the triggered when the scale of WebView changed. 6338 * 6339 * @typedef OnScaleChangeEvent 6340 * @syscap SystemCapability.Web.Webview.Core 6341 * @crossplatform 6342 * @atomicservice 6343 * @since 12 6344 */ 6345declare interface OnScaleChangeEvent { 6346 /** 6347 * Old scale of the page. 6348 * 6349 * @type { number } 6350 * @syscap SystemCapability.Web.Webview.Core 6351 * @crossplatform 6352 * @atomicservice 6353 * @since 12 6354 */ 6355 oldScale: number; 6356 6357 /** 6358 * New scale of the page. 6359 * 6360 * @type { number } 6361 * @syscap SystemCapability.Web.Webview.Core 6362 * @crossplatform 6363 * @atomicservice 6364 * @since 12 6365 */ 6366 newScale: number; 6367} 6368 6369/** 6370 * Defines the triggered when the browser needs credentials from the user. 6371 * 6372 * @typedef OnHttpAuthRequestEvent 6373 * @syscap SystemCapability.Web.Webview.Core 6374 * @crossplatform 6375 * @atomicservice 6376 * @since 12 6377 */ 6378declare interface OnHttpAuthRequestEvent { 6379 /** 6380 * Defines the http auth request result. 6381 * 6382 * @type { HttpAuthHandler } 6383 * @syscap SystemCapability.Web.Webview.Core 6384 * @crossplatform 6385 * @atomicservice 6386 * @since 12 6387 */ 6388 handler: HttpAuthHandler; 6389 6390 /** 6391 * Host of the page. 6392 * 6393 * @type { string } 6394 * @syscap SystemCapability.Web.Webview.Core 6395 * @crossplatform 6396 * @atomicservice 6397 * @since 12 6398 */ 6399 host: string; 6400 6401 /** 6402 * realm of the page. 6403 * 6404 * @type { string } 6405 * @syscap SystemCapability.Web.Webview.Core 6406 * @crossplatform 6407 * @atomicservice 6408 * @since 12 6409 */ 6410 realm: string; 6411} 6412 6413/** 6414 * Defines the triggered callback when the resources loading is intercepted. 6415 * 6416 * @typedef OnInterceptRequestEvent 6417 * @syscap SystemCapability.Web.Webview.Core 6418 * @atomicservice 6419 * @since 12 6420 */ 6421declare interface OnInterceptRequestEvent { 6422 /** 6423 * The information of request. 6424 * 6425 * @type { WebResourceRequest } 6426 * @syscap SystemCapability.Web.Webview.Core 6427 * @atomicservice 6428 * @since 12 6429 */ 6430 request: WebResourceRequest; 6431} 6432 6433/** 6434 * Defines the triggered callback when the host application that web content from the specified origin is 6435 * attempting to access the resources. 6436 * 6437 * @typedef OnPermissionRequestEvent 6438 * @syscap SystemCapability.Web.Webview.Core 6439 * @crossplatform 6440 * @atomicservice 6441 * @since arkts {'1.1':'12', '1.2':'20'} 6442 * @arkts 1.1&1.2 6443 */ 6444declare interface OnPermissionRequestEvent { 6445 /** 6446 * Defines the onPermissionRequest callback. 6447 * 6448 * @type { PermissionRequest } 6449 * @syscap SystemCapability.Web.Webview.Core 6450 * @crossplatform 6451 * @atomicservice 6452 * @since arkts {'1.1':'12', '1.2':'20'} 6453 * @arkts 1.1&1.2 6454 */ 6455 request: PermissionRequest; 6456} 6457 6458/** 6459 * Defines the triggered callback when the host application that web content from the specified origin is 6460 * requesting to capture screen. 6461 * 6462 * @typedef OnScreenCaptureRequestEvent 6463 * @syscap SystemCapability.Web.Webview.Core 6464 * @atomicservice 6465 * @since arkts {'1.1':'12', '1.2':'20'} 6466 * @arkts 1.1&1.2 6467 */ 6468declare interface OnScreenCaptureRequestEvent { 6469 /** 6470 * Notifies the user of the operation behavior of the web component. 6471 * 6472 * @type { ScreenCaptureHandler } 6473 * @syscap SystemCapability.Web.Webview.Core 6474 * @atomicservice 6475 * @since arkts {'1.1':'12', '1.2':'20'} 6476 * @arkts 1.1&1.2 6477 */ 6478 handler: ScreenCaptureHandler; 6479} 6480 6481/** 6482 * Defines the triggered callback when called to allow custom display of the context menu. 6483 * 6484 * @typedef OnContextMenuShowEvent 6485 * @syscap SystemCapability.Web.Webview.Core 6486 * @atomicservice 6487 * @since arkts {'1.1':'12', '1.2':'20'} 6488 * @arkts 1.1&1.2 6489 */ 6490declare interface OnContextMenuShowEvent { 6491 /** 6492 * The menu-related parameters. 6493 * 6494 * @type { WebContextMenuParam } 6495 * @syscap SystemCapability.Web.Webview.Core 6496 * @atomicservice 6497 * @since arkts {'1.1':'12', '1.2':'20'} 6498 * @arkts 1.1&1.2 6499 */ 6500 param: WebContextMenuParam; 6501 6502 /** 6503 * The menu corresponding event is passed to the kernel. 6504 * 6505 * @type { WebContextMenuResult } 6506 * @syscap SystemCapability.Web.Webview.Core 6507 * @atomicservice 6508 * @since arkts {'1.1':'12', '1.2':'20'} 6509 * @arkts 1.1&1.2 6510 */ 6511 result: WebContextMenuResult; 6512} 6513 6514/** 6515 * Defines function Triggered when the host application call searchAllAsync. 6516 * 6517 * @typedef OnSearchResultReceiveEvent 6518 * @syscap SystemCapability.Web.Webview.Core 6519 * @atomicservice 6520 * @since 12 6521 */ 6522declare interface OnSearchResultReceiveEvent { 6523 /** 6524 * The ordinal number of the currently matched lookup item (starting from 0). 6525 * 6526 * @type { number } 6527 * @syscap SystemCapability.Web.Webview.Core 6528 * @atomicservice 6529 * @since 12 6530 */ 6531 activeMatchOrdinal: number; 6532 6533 /** 6534 * The number of all matched keywords. 6535 * 6536 * @type { number } 6537 * @syscap SystemCapability.Web.Webview.Core 6538 * @atomicservice 6539 * @since 12 6540 */ 6541 numberOfMatches: number; 6542 6543 /** 6544 * Indicates whether the current in-page search operation is complete. The method may be called back multiple times until isDoneCounting is true. 6545 * 6546 * @type { boolean } 6547 * @syscap SystemCapability.Web.Webview.Core 6548 * @atomicservice 6549 * @since 12 6550 */ 6551 isDoneCounting: boolean; 6552} 6553 6554/** 6555 * Defines function Triggered when the scroll bar slides to the specified position. 6556 * 6557 * @typedef OnScrollEvent 6558 * @syscap SystemCapability.Web.Webview.Core 6559 * @crossplatform 6560 * @atomicservice 6561 * @since 12 6562 */ 6563declare interface OnScrollEvent { 6564 /** 6565 * The X offset of the scroll. Unit: vp. 6566 * 6567 * @type { number } 6568 * @syscap SystemCapability.Web.Webview.Core 6569 * @crossplatform 6570 * @atomicservice 6571 * @since 12 6572 */ 6573 xOffset: number; 6574 6575 /** 6576 * The Y offset of the scroll. Unit: vp. 6577 * 6578 * @type { number } 6579 * @syscap SystemCapability.Web.Webview.Core 6580 * @crossplatform 6581 * @atomicservice 6582 * @since 12 6583 */ 6584 yOffset: number; 6585} 6586 6587/** 6588 * Defines the triggered callback when the Web page receives an ssl Error. 6589 * 6590 * @typedef OnSslErrorEventReceiveEvent 6591 * @syscap SystemCapability.Web.Webview.Core 6592 * @atomicservice 6593 * @since 12 6594 */ 6595declare interface OnSslErrorEventReceiveEvent { 6596 /** 6597 * Notifies the user of the operation behavior of the web component. 6598 * 6599 * @type { SslErrorHandler } 6600 * @syscap SystemCapability.Web.Webview.Core 6601 * @atomicservice 6602 * @since 12 6603 */ 6604 handler: SslErrorHandler; 6605 6606 /** 6607 * Error codes. 6608 * 6609 * @type { SslError } 6610 * @syscap SystemCapability.Web.Webview.Core 6611 * @atomicservice 6612 * @since 12 6613 */ 6614 error: SslError; 6615 6616 /** 6617 * Certificate chain data in DER format. 6618 * 6619 * @type { ?Array<Uint8Array> } 6620 * @syscap SystemCapability.Web.Webview.Core 6621 * @since 15 6622 */ 6623 certChainData?: Array<Uint8Array>; 6624} 6625 6626/** 6627 * Defines the triggered callback when needs ssl client certificate from the user. 6628 * 6629 * @typedef OnClientAuthenticationEvent 6630 * @syscap SystemCapability.Web.Webview.Core 6631 * @atomicservice 6632 * @since 12 6633 */ 6634declare interface OnClientAuthenticationEvent { 6635 /** 6636 * Notifies the user of the operation behavior of the web component. 6637 * 6638 * @type { ClientAuthenticationHandler } 6639 * @syscap SystemCapability.Web.Webview.Core 6640 * @atomicservice 6641 * @since 12 6642 */ 6643 handler : ClientAuthenticationHandler; 6644 6645 /** 6646 * The hostname of the requesting certificate server. 6647 * 6648 * @type { string } 6649 * @syscap SystemCapability.Web.Webview.Core 6650 * @atomicservice 6651 * @since 12 6652 */ 6653 host : string; 6654 6655 /** 6656 * The port number of the request certificate server. 6657 * 6658 * @type { number } 6659 * @syscap SystemCapability.Web.Webview.Core 6660 * @atomicservice 6661 * @since 12 6662 */ 6663 port : number; 6664 6665 /** 6666 * Acceptable asymmetric key types. 6667 * 6668 * @type { Array<string> } 6669 * @syscap SystemCapability.Web.Webview.Core 6670 * @atomicservice 6671 * @since 12 6672 */ 6673 keyTypes : Array<string>; 6674 6675 /** 6676 * Certificates that match the private key are acceptable to the issuer. 6677 * 6678 * @type { Array<string> } 6679 * @syscap SystemCapability.Web.Webview.Core 6680 * @atomicservice 6681 * @since 12 6682 */ 6683 issuers : Array<string>; 6684} 6685 6686/** 6687 * Defines the triggered callback when web page requires the user to create a window. 6688 * 6689 * @typedef OnWindowNewEvent 6690 * @syscap SystemCapability.Web.Webview.Core 6691 * @atomicservice 6692 * @since 12 6693 */ 6694declare interface OnWindowNewEvent { 6695 /** 6696 * true indicates the request to create a dialog and false indicates a new tab. 6697 * 6698 * @type { boolean } 6699 * @syscap SystemCapability.Web.Webview.Core 6700 * @atomicservice 6701 * @since 12 6702 */ 6703 isAlert: boolean; 6704 6705 /** 6706 * true indicates that it is triggered by the user, and false indicates that it is triggered by a non-user. 6707 * 6708 * @type { boolean } 6709 * @syscap SystemCapability.Web.Webview.Core 6710 * @atomicservice 6711 * @since 12 6712 */ 6713 isUserTrigger: boolean; 6714 6715 /** 6716 * Destination URL. 6717 * 6718 * @type { string } 6719 * @syscap SystemCapability.Web.Webview.Core 6720 * @atomicservice 6721 * @since 12 6722 */ 6723 targetUrl: string; 6724 6725 /** 6726 * Lets you set the WebviewController instance for creating a new window. 6727 * 6728 * @type { ControllerHandler } 6729 * @syscap SystemCapability.Web.Webview.Core 6730 * @atomicservice 6731 * @since 12 6732 */ 6733 handler: ControllerHandler; 6734} 6735 6736/** 6737 * Defines the triggered callback when the application receive an new url of an apple-touch-icon. 6738 * 6739 * @typedef OnTouchIconUrlReceivedEvent 6740 * @syscap SystemCapability.Web.Webview.Core 6741 * @atomicservice 6742 * @since 12 6743 */ 6744declare interface OnTouchIconUrlReceivedEvent { 6745 /** 6746 * The apple-touch-icon URL address received. 6747 * 6748 * @type { string } 6749 * @syscap SystemCapability.Web.Webview.Core 6750 * @atomicservice 6751 * @since 12 6752 */ 6753 url: string; 6754 6755 /** 6756 * Corresponding to whether apple-touch-icon is precomposited. 6757 * 6758 * @type { boolean } 6759 * @syscap SystemCapability.Web.Webview.Core 6760 * @atomicservice 6761 * @since 12 6762 */ 6763 precomposed: boolean; 6764} 6765 6766/** 6767 * Defines the triggered callback when the application receive a new favicon for the current web page. 6768 * 6769 * @typedef OnFaviconReceivedEvent 6770 * @syscap SystemCapability.Web.Webview.Core 6771 * @atomicservice 6772 * @since 12 6773 */ 6774declare interface OnFaviconReceivedEvent { 6775 /** 6776 * Received the Favicon icon for the PixelMap object. 6777 * 6778 * @type { PixelMap } 6779 * @syscap SystemCapability.Web.Webview.Core 6780 * @atomicservice 6781 * @since 12 6782 */ 6783 favicon: PixelMap; 6784} 6785 6786/** 6787 * Defines the triggered callback when previous page will no longer be drawn and next page begin to draw. 6788 * 6789 * @typedef OnPageVisibleEvent 6790 * @syscap SystemCapability.Web.Webview.Core 6791 * @crossplatform 6792 * @atomicservice 6793 * @since arkts {'1.1':'12', '1.2':'20'} 6794 * @arkts 1.1&1.2 6795 */ 6796declare interface OnPageVisibleEvent { 6797 /** 6798 * The URL of page. 6799 * 6800 * @type { string } 6801 * @syscap SystemCapability.Web.Webview.Core 6802 * @crossplatform 6803 * @atomicservice 6804 * @since arkts {'1.1':'12', '1.2':'20'} 6805 * @arkts 1.1&1.2 6806 */ 6807 url: string; 6808} 6809 6810/** 6811 * Defines the triggered callback to decision whether resend form data or not. 6812 * 6813 * @typedef OnDataResubmittedEvent 6814 * @syscap SystemCapability.Web.Webview.Core 6815 * @atomicservice 6816 * @since 12 6817 */ 6818declare interface OnDataResubmittedEvent { 6819 /** 6820 * Form data resubmission handle. 6821 * 6822 * @type { DataResubmissionHandler } 6823 * @syscap SystemCapability.Web.Webview.Core 6824 * @atomicservice 6825 * @since 12 6826 */ 6827 handler: DataResubmissionHandler; 6828} 6829 6830/** 6831 * Defines the playing state of audio on web page. 6832 * 6833 * @typedef OnAudioStateChangedEvent 6834 * @syscap SystemCapability.Web.Webview.Core 6835 * @atomicservice 6836 * @since 12 6837 */ 6838declare interface OnAudioStateChangedEvent { 6839 /** 6840 * The audio playback status of the current page, true if playing true otherwise false. 6841 * 6842 * @type { boolean } 6843 * @syscap SystemCapability.Web.Webview.Core 6844 * @atomicservice 6845 * @since 12 6846 */ 6847 playing: boolean; 6848} 6849 6850/** 6851 * Defines triggered when the first content rendering of web page. 6852 * 6853 * @typedef OnFirstContentfulPaintEvent 6854 * @syscap SystemCapability.Web.Webview.Core 6855 * @atomicservice 6856 * @since 12 6857 */ 6858declare interface OnFirstContentfulPaintEvent { 6859 /** 6860 * The time at which navigation begins, expressed in microseconds. 6861 * 6862 * @type { number } 6863 * @syscap SystemCapability.Web.Webview.Core 6864 * @atomicservice 6865 * @since 12 6866 */ 6867 navigationStartTick: number; 6868 6869 /** 6870 * The time it takes to draw content for the first time from navigation, expressed in milliseconds. 6871 * 6872 * @type { number } 6873 * @syscap SystemCapability.Web.Webview.Core 6874 * @atomicservice 6875 * @since 12 6876 */ 6877 firstContentfulPaintMs: number; 6878} 6879 6880/** 6881 * Defines the triggered callback when the resources loading is intercepted. 6882 * 6883 * @typedef OnLoadInterceptEvent 6884 * @syscap SystemCapability.Web.Webview.Core 6885 * @crossplatform 6886 * @atomicservice 6887 * @since arkts {'1.1':'12', '1.2':'20'} 6888 * @arkts 1.1&1.2 6889 */ 6890declare interface OnLoadInterceptEvent { 6891 /** 6892 * The information of request. 6893 * 6894 * @type { WebResourceRequest } 6895 * @syscap SystemCapability.Web.Webview.Core 6896 * @crossplatform 6897 * @atomicservice 6898 * @since 12 6899 */ 6900 data: WebResourceRequest; 6901} 6902 6903/** 6904 * Defines the function Triggered when the over scrolling. 6905 * 6906 * @typedef OnOverScrollEvent 6907 * @syscap SystemCapability.Web.Webview.Core 6908 * @atomicservice 6909 * @since 12 6910 */ 6911declare interface OnOverScrollEvent { 6912 /** 6913 * Based on the leftmost part of the page, the horizontal scroll offset is over. 6914 * Unit: vp. 6915 * 6916 * @type { number } 6917 * @syscap SystemCapability.Web.Webview.Core 6918 * @atomicservice 6919 * @since 12 6920 */ 6921 xOffset: number; 6922 6923 /** 6924 * Based on the top of the page, the vertical scroll offset is over. 6925 * Unit: vp. 6926 * 6927 * @type { number } 6928 * @syscap SystemCapability.Web.Webview.Core 6929 * @atomicservice 6930 * @since 12 6931 */ 6932 yOffset: number; 6933} 6934 6935/** 6936 * Defines the function Triggered when the PDF page scrolling. 6937 * 6938 * @typedef OnPdfScrollEvent 6939 * @syscap SystemCapability.Web.Webview.Core 6940 * @since 20 6941 */ 6942declare interface OnPdfScrollEvent { 6943 6944 /** 6945 * PDF page url. 6946 * 6947 * @type { string } 6948 * @syscap SystemCapability.Web.Webview.Core 6949 * @since 20 6950 */ 6951 url:string; 6952} 6953 6954/** 6955 * Defines the function Triggered when the PDF load. 6956 * 6957 * @typedef OnPdfLoadEvent 6958 * @syscap SystemCapability.Web.Webview.Core 6959 * @since 20 6960 */ 6961declare interface OnPdfLoadEvent { 6962 /** 6963 * The PDF page load result. 6964 * 6965 * @type { PdfLoadResult } 6966 * @syscap SystemCapability.Web.Webview.Core 6967 * @since 20 6968 */ 6969 result: PdfLoadResult; 6970 6971 /** 6972 * The PDF page url. 6973 * 6974 * @type { string } 6975 * @syscap SystemCapability.Web.Webview.Core 6976 * @since 20 6977 */ 6978 url: string; 6979} 6980 6981/** 6982 * Defines the JavaScript object to be injected. 6983 * 6984 * @typedef JavaScriptProxy 6985 * @syscap SystemCapability.Web.Webview.Core 6986 * @atomicservice 6987 * @since 12 6988 */ 6989/** 6990 * Defines the JavaScript object to be injected. 6991 * 6992 * @typedef JavaScriptProxy 6993 * @syscap SystemCapability.Web.Webview.Core 6994 * @crossplatform 6995 * @atomicservice 6996 * @since 20 6997 */ 6998declare interface JavaScriptProxy { 6999 /** 7000 * Objects participating in registration. 7001 * 7002 * @type { object } 7003 * @syscap SystemCapability.Web.Webview.Core 7004 * @atomicservice 7005 * @since 12 7006 */ 7007 /** 7008 * Objects participating in registration. 7009 * 7010 * @type { object } 7011 * @syscap SystemCapability.Web.Webview.Core 7012 * @crossplatform 7013 * @atomicservice 7014 * @since 20 7015 */ 7016 object: object; 7017 7018 /** 7019 * The name of the registered object, which is consistent with the 7020 * object name called in the window. 7021 * 7022 * @type { string } 7023 * @syscap SystemCapability.Web.Webview.Core 7024 * @atomicservice 7025 * @since 12 7026 */ 7027 /** 7028 * The name of the registered object, which is consistent with the 7029 * object name called in the window. 7030 * 7031 * @type { string } 7032 * @syscap SystemCapability.Web.Webview.Core 7033 * @crossplatform 7034 * @atomicservice 7035 * @since 20 7036 */ 7037 name: string; 7038 7039 /** 7040 * The method of the application side JavaScript object participating 7041 * in the registration. 7042 * 7043 * @type { Array<string> } 7044 * @syscap SystemCapability.Web.Webview.Core 7045 * @atomicservice 7046 * @since 12 7047 */ 7048 /** 7049 * The method of the application side JavaScript object participating 7050 * in the registration. 7051 * 7052 * @type { Array<string> } 7053 * @syscap SystemCapability.Web.Webview.Core 7054 * @crossplatform 7055 * @atomicservice 7056 * @since 20 7057 */ 7058 methodList: Array<string>; 7059 7060 /** 7061 * Controller. 7062 * 7063 * @type { WebController | WebviewController } 7064 * @syscap SystemCapability.Web.Webview.Core 7065 * @atomicservice 7066 * @since 12 7067 */ 7068 /** 7069 * Controller. 7070 * 7071 * @type { WebController | WebviewController } 7072 * @syscap SystemCapability.Web.Webview.Core 7073 * @crossplatform 7074 * @atomicservice 7075 * @since 20 7076 */ 7077 controller: WebController | WebviewController; 7078 7079 /** 7080 * The async method of the application side JavaScript object participating in the registration. 7081 * 7082 * @type { ?Array<string> } 7083 * @syscap SystemCapability.Web.Webview.Core 7084 * @atomicservice 7085 * @since 12 7086 */ 7087 /** 7088 * The async method of the application side JavaScript object participating in the registration. 7089 * 7090 * @type { ?Array<string> } 7091 * @syscap SystemCapability.Web.Webview.Core 7092 * @crossplatform 7093 * @atomicservice 7094 * @since 20 7095 */ 7096 asyncMethodList?: Array<string>; 7097 7098 /** 7099 * permission configuration defining web page URLs that can access JavaScriptProxy methods. 7100 * The configuration can be defined at two levels, object level and method level. 7101 * 7102 * @type { ?string } 7103 * @syscap SystemCapability.Web.Webview.Core 7104 * @atomicservice 7105 * @since 12 7106 */ 7107 permission?: string; 7108} 7109 7110/** 7111 * Enum type supplied to {@link keyboardAvoidMode} for setting the web keyboard avoid mode. 7112 * 7113 * @enum { number } 7114 * @syscap SystemCapability.Web.Webview.Core 7115 * @atomicservice 7116 * @since 12 7117 */ 7118declare enum WebKeyboardAvoidMode { 7119 /** 7120 * When the soft keyboard avoids, only the size of the visual viewport is adjusted, not the size of the layout viewport. 7121 * 7122 * @syscap SystemCapability.Web.Webview.Core 7123 * @atomicservice 7124 * @since 12 7125 */ 7126 RESIZE_VISUAL = 0, 7127 7128 /** 7129 * By default, when the soft keyboard avoids, 7130 * the sizes of the visual viewport and the layout viewport are adjusted at the same time. 7131 * 7132 * @syscap SystemCapability.Web.Webview.Core 7133 * @atomicservice 7134 * @since 12 7135 */ 7136 RESIZE_CONTENT = 1, 7137 7138 /** 7139 * Without adjusting any viewport size, soft keyboard avoidance will not be triggered. 7140 * 7141 * @syscap SystemCapability.Web.Webview.Core 7142 * @atomicservice 7143 * @since 12 7144 */ 7145 OVERLAYS_CONTENT = 2 7146} 7147 7148/** 7149 * Defines Web Elements type. 7150 * 7151 * @enum { number } 7152 * @syscap SystemCapability.Web.Webview.Core 7153 * @since 13 7154 */ 7155declare enum WebElementType { 7156 /** 7157 * Image,corresponding HTML image type. 7158 * 7159 * @syscap SystemCapability.Web.Webview.Core 7160 * @since 13 7161 */ 7162 IMAGE = 1, 7163 7164 /** 7165 * Link,corresponding link type. 7166 * 7167 * @syscap SystemCapability.Web.Webview.Core 7168 * @since 20 7169 */ 7170 LINK = 2 7171} 7172 7173/** 7174 * ResponseType for contextMenu 7175 * 7176 * @enum { number } 7177 * @syscap SystemCapability.Web.Webview.Core 7178 * @since 13 7179 */ 7180declare enum WebResponseType { 7181 /** 7182 * Long press. 7183 * 7184 * @syscap SystemCapability.Web.Webview.Core 7185 * @since 13 7186 */ 7187 LONG_PRESS = 1 7188} 7189 7190/** 7191 * Enum type supplied to {@link bypassVsyncCondition} for setting the bypass vsync condition. 7192 * 7193 * @enum { number } 7194 * @syscap SystemCapability.Web.Webview.Core 7195 * @since 20 7196 */ 7197declare enum WebBypassVsyncCondition { 7198 /** 7199 * Not bypass vsync. 7200 * 7201 * @syscap SystemCapability.Web.Webview.Core 7202 * @since 20 7203 */ 7204 NONE = 0, 7205 7206 /** 7207 * bypass vsync. 7208 * 7209 * @syscap SystemCapability.Web.Webview.Core 7210 * @since 20 7211 */ 7212 SCROLLBY_FROM_ZERO_OFFSET = 1 7213} 7214 7215/** 7216 * Arkweb audio session Type 7217 * 7218 * @enum { number } 7219 * @syscap SystemCapability.Web.Webview.Core 7220 * @since 20 7221 */ 7222declare enum AudioSessionType { 7223 /** 7224 * Ambient audio, which is mixable with other types of audio. 7225 * This is useful in some special cases such as when the user wants to mix audios from multiple pages. 7226 * 7227 * @syscap SystemCapability.Web.Webview.Core 7228 * @since 20 7229 */ 7230 AMBIENT=3 7231} 7232 7233/** 7234 * PDF page load result 7235 * 7236 * @enum { number } 7237 * @syscap SystemCapability.Web.Webview.Core 7238 * @since 20 7239 */ 7240declare enum PdfLoadResult { 7241 7242 /** 7243 * The PDF page load success. 7244 * 7245 * @syscap SystemCapability.Web.Webview.Core 7246 * @since 20 7247 */ 7248 LOAD_SUCCESS = 0, 7249 7250 /** 7251 * The error code for web load PDF file failed. 7252 * 7253 * @syscap SystemCapability.Web.Webview.Core 7254 * @since 20 7255 */ 7256 PARSE_ERROR_FILE = 1, 7257 7258 /** 7259 * The error code for the PDF format is not support. 7260 * 7261 * @syscap SystemCapability.Web.Webview.Core 7262 * @since 20 7263 */ 7264 PARSE_ERROR_FORMAT = 2, 7265 7266 /** 7267 * The error code for the PDF password is wrong. 7268 * 7269 * @syscap SystemCapability.Web.Webview.Core 7270 * @since 20 7271 */ 7272 PARSE_ERROR_PASSWORD = 3, 7273 7274 /** 7275 * The error code for the PDF handler process failed. 7276 * 7277 * @syscap SystemCapability.Web.Webview.Core 7278 * @since 20 7279 */ 7280 PARSE_ERROR_HANDLER = 4 7281} 7282 7283/** 7284 * Defines the options of preview menu 7285 * 7286 * @interface PreviewMenuOptions 7287 * @syscap SystemCapability.Web.Webview.Core 7288 * @since 20 7289 */ 7290declare interface PreviewMenuOptions { 7291 /** 7292 * Defines the haptic feedback mode of preview menu. 7293 * 7294 * @type { ?HapticFeedbackMode } 7295 * @syscap SystemCapability.Web.Webview.Core 7296 * @since 20 7297 */ 7298 hapticFeedbackMode?: HapticFeedbackMode; 7299} 7300 7301/** 7302 * Defines the selection menu options. 7303 * 7304 * @typedef SelectionMenuOptionsExt 7305 * @syscap SystemCapability.Web.Webview.Core 7306 * @since 13 7307 */ 7308declare interface SelectionMenuOptionsExt { 7309 /** 7310 * Callback function when the selection menu appears. 7311 * 7312 * @type { ?Callback<void> } 7313 * @syscap SystemCapability.Web.Webview.Core 7314 * @since 13 7315 */ 7316 onAppear?: Callback<void>; 7317 7318 /** 7319 * Callback function when the selection menu disappears. 7320 * 7321 * @type { ?Callback<void> } 7322 * @syscap SystemCapability.Web.Webview.Core 7323 * @since 13 7324 */ 7325 onDisappear?: Callback<void>; 7326 7327 /** 7328 * The preview content of selection menu. 7329 * 7330 * @type { ?CustomBuilder } 7331 * @syscap SystemCapability.Web.Webview.Core 7332 * @since 13 7333 */ 7334 preview?: CustomBuilder; 7335 7336 /** 7337 * Menu type, default value is MenuType.SELECTION_MENU. 7338 * 7339 * @type { ?MenuType } 7340 * @syscap SystemCapability.Web.Webview.Core 7341 * @since 13 7342 */ 7343 menuType?: MenuType; 7344 7345 /** 7346 * Defines the options of preview menu. 7347 * 7348 * @type { ?PreviewMenuOptions } 7349 * @syscap SystemCapability.Web.Webview.Core 7350 * @since 20 7351 */ 7352 previewMenuOptions?: PreviewMenuOptions; 7353} 7354 7355/** 7356 * Defines the Web attribute functions. 7357 * 7358 * @extends CommonMethod<WebAttribute> 7359 * @syscap SystemCapability.Web.Webview.Core 7360 * @since 8 7361 */ 7362/** 7363 * Defines the Web attribute functions. 7364 * 7365 * @extends CommonMethod<WebAttribute> 7366 * @syscap SystemCapability.Web.Webview.Core 7367 * @crossplatform 7368 * @since 10 7369 */ 7370/** 7371 * Defines the Web attribute functions. 7372 * 7373 * @extends CommonMethod<WebAttribute> 7374 * @syscap SystemCapability.Web.Webview.Core 7375 * @crossplatform 7376 * @atomicservice 7377 * @since arkts {'1.1':'11', '1.2':'20'} 7378 * @arkts 1.1&1.2 7379 */ 7380declare class WebAttribute extends CommonMethod<WebAttribute> { 7381 /** 7382 * Sets whether the Web allows JavaScript scripts to execute. 7383 * 7384 * @param { boolean } javaScriptAccess - {@code true} means the Web can allows JavaScript scripts to execute; {@code false} otherwise. 7385 * The default value is true. 7386 * @returns { WebAttribute } 7387 * @syscap SystemCapability.Web.Webview.Core 7388 * @since 8 7389 */ 7390 /** 7391 * Sets whether the Web allows JavaScript scripts to execute. 7392 * 7393 * @param { boolean } javaScriptAccess - {@code true} means the Web can allows JavaScript scripts to execute; {@code false} otherwise. 7394 * The default value is true. 7395 * @returns { WebAttribute } 7396 * @syscap SystemCapability.Web.Webview.Core 7397 * @crossplatform 7398 * @since 10 7399 */ 7400 /** 7401 * Sets whether the Web allows JavaScript scripts to execute. 7402 * 7403 * @param { boolean } javaScriptAccess - {@code true} means the Web can allows JavaScript scripts to execute; {@code false} otherwise. 7404 * The default value is true. 7405 * @returns { WebAttribute } 7406 * @syscap SystemCapability.Web.Webview.Core 7407 * @crossplatform 7408 * @atomicservice 7409 * @since arkts {'1.1':'11', '1.2':'20'} 7410 * @arkts 1.1&1.2 7411 */ 7412 javaScriptAccess(javaScriptAccess: boolean): WebAttribute; 7413 7414 /** 7415 * Sets whether enable local file system access in web. 7416 * 7417 * @param { boolean } fileAccess - {@code true} means enable local file system access in Web; {@code false} otherwise. 7418 * The default value is true. 7419 * @returns { WebAttribute } 7420 * @syscap SystemCapability.Web.Webview.Core 7421 * @since 8 7422 */ 7423 /** 7424 * Sets whether enable local file system access in web. 7425 * 7426 * @param { boolean } fileAccess - {@code true} means enable local file system access in Web; {@code false} otherwise. 7427 * The default value is true. 7428 * @returns { WebAttribute } 7429 * @syscap SystemCapability.Web.Webview.Core 7430 * @atomicservice 7431 * @since 11 7432 */ 7433 /** 7434 * Sets whether to enable access to the file system in the application. 7435 * This setting dose not affect the access to the files specified though $rawfile(filepath/filename). 7436 * <p><strong>API Note</strong>:<br> 7437 * fileAccess is disabled by default since API version 12. 7438 * When fileAccess is set to false, files in the read-only /data/storage/el1/bundle/entry/resources/resfile<br> 7439 * directory can still be accessed through the file protocol. 7440 * </p> 7441 * 7442 * @param { boolean } fileAccess - {@code true} means enable local file system access in Web; {@code false} otherwise. 7443 * The default value is false. 7444 * @returns { WebAttribute } 7445 * @syscap SystemCapability.Web.Webview.Core 7446 * @atomicservice 7447 * @since 12 7448 */ 7449 fileAccess(fileAccess: boolean): WebAttribute; 7450 7451 /** 7452 * Sets whether to allow image resources to be loaded from the network. 7453 * 7454 * @param { boolean } onlineImageAccess - {@code true} means the Web can allow image resources to be loaded from the network; 7455 * The default value is true. 7456 * {@code false} otherwise. 7457 * @returns { WebAttribute } 7458 * @syscap SystemCapability.Web.Webview.Core 7459 * @since 8 7460 */ 7461 /** 7462 * Sets whether to enable access to online images through HTTP and HTTPS. 7463 * 7464 * @param { boolean } onlineImageAccess - Sets whether to enable access to online images. 7465 * {@code true} means means setting to allow loading image resources from the network, {@code false} otherwise. 7466 * Default value: true. 7467 * @returns { WebAttribute } 7468 * @syscap SystemCapability.Web.Webview.Core 7469 * @atomicservice 7470 * @since 11 7471 */ 7472 /** 7473 * Sets whether to enable access to online images through HTTP and HTTPS. 7474 * 7475 * @param { boolean } onlineImageAccess - Sets whether to enable access to online images. 7476 * {@code true} means means setting to allow loading image resources from the network, {@code false} otherwise. 7477 * Default value: true. 7478 * @returns { WebAttribute } 7479 * @syscap SystemCapability.Web.Webview.Core 7480 * @crossplatform 7481 * @atomicservice 7482 * @since 18 7483 */ 7484 onlineImageAccess(onlineImageAccess: boolean): WebAttribute; 7485 7486 /** 7487 * Sets whether to enable the DOM Storage API permission. 7488 * 7489 * @param { boolean } domStorageAccess - {@code true} means enable the DOM Storage API permission in Web; {@code false} otherwise. 7490 * The default value is false. 7491 * @returns { WebAttribute } 7492 * @syscap SystemCapability.Web.Webview.Core 7493 * @since 8 7494 */ 7495 /** 7496 * Sets whether to enable the DOM Storage API permission. 7497 * 7498 * @param { boolean } domStorageAccess - {@code true} means enable the DOM Storage API permission in Web; {@code false} otherwise. 7499 * The default value is false. 7500 * @returns { WebAttribute } 7501 * @syscap SystemCapability.Web.Webview.Core 7502 * @atomicservice 7503 * @since 11 7504 */ 7505 /** 7506 * Sets whether to enable the DOM Storage API. By default, this feature is disabled. 7507 * @param { boolean } domStorageAccess - Whether to enable the DOM Storage API. {@code true} means to enable 7508 * the DOM Storage API; {@code false} means to disable the DOM Storage API. 7509 * The default value is false. 7510 * @returns { WebAttribute } 7511 * @syscap SystemCapability.Web.Webview.Core 7512 * @crossplatform 7513 * @atomicservice 7514 * @since 18 7515 */ 7516 domStorageAccess(domStorageAccess: boolean): WebAttribute; 7517 7518 /** 7519 * Sets whether the Web can automatically load image resources. 7520 * 7521 * @param { boolean } imageAccess - {@code true} means the Web can automatically load image resources; {@code false} otherwise. 7522 * The default value is true. 7523 * @returns { WebAttribute } 7524 * @syscap SystemCapability.Web.Webview.Core 7525 * @since 8 7526 */ 7527 /** 7528 * Sets whether the Web can automatically load image resources. 7529 * 7530 * @param { boolean } imageAccess - {@code true} means the Web can automatically load image resources; {@code false} otherwise. 7531 * The default value is true. 7532 * @returns { WebAttribute } 7533 * @syscap SystemCapability.Web.Webview.Core 7534 * @atomicservice 7535 * @since 11 7536 */ 7537 /** 7538 * Sets whether to enable automatic image loading. 7539 * 7540 * @param { boolean } imageAccess - Sets whether to enable automatic image loading. 7541 * {@code true} means the Web can automatically load image resources, {@code false} otherwise. 7542 * Default value: true. 7543 * @returns { WebAttribute } 7544 * @syscap SystemCapability.Web.Webview.Core 7545 * @crossplatform 7546 * @atomicservice 7547 * @since 18 7548 */ 7549 imageAccess(imageAccess: boolean): WebAttribute; 7550 7551 /** 7552 * Sets how to load HTTP and HTTPS content. 7553 * 7554 * @param { MixedMode } mixedMode - The mixed mode, which can be {@link MixedMode}. 7555 * @returns { WebAttribute } 7556 * @syscap SystemCapability.Web.Webview.Core 7557 * @since 8 7558 */ 7559 /** 7560 * Sets how to load HTTP and HTTPS content. 7561 * 7562 * @param { MixedMode } mixedMode - The mixed mode, which can be {@link MixedMode}. 7563 * @returns { WebAttribute } 7564 * @syscap SystemCapability.Web.Webview.Core 7565 * @atomicservice 7566 * @since 11 7567 */ 7568 /** 7569 * Sets the behavior when a secure origin attempts to load a resource from an insecure origin. 7570 * The default is MixedMode.None, meaning not allow a secure origin to load content from an insecure origin. 7571 * 7572 * @param { MixedMode } mixedMode - The mixed mode, which can be {@link MixedMode}. 7573 * Default value: MixedMode.None, which means that secure origin is not allowed to load content from insecure origin. 7574 * @returns { WebAttribute } 7575 * @syscap SystemCapability.Web.Webview.Core 7576 * @crossplatform 7577 * @atomicservice 7578 * @since 18 7579 */ 7580 mixedMode(mixedMode: MixedMode): WebAttribute; 7581 7582 /** 7583 * Sets whether the Web supports zooming using gestures. 7584 * 7585 * @param { boolean } zoomAccess {@code true} means the Web supports zooming using gestures; {@code false} otherwise. 7586 * The default value is true. 7587 * @returns { WebAttribute } 7588 * @syscap SystemCapability.Web.Webview.Core 7589 * @since 8 7590 */ 7591 /** 7592 * Sets whether the Web supports zooming using gestures. 7593 * 7594 * @param { boolean } zoomAccess {@code true} means the Web supports zooming using gestures; {@code false} otherwise. 7595 * The default value is true. 7596 * @returns { WebAttribute } 7597 * @syscap SystemCapability.Web.Webview.Core 7598 * @crossplatform 7599 * @since 10 7600 */ 7601 /** 7602 * Sets whether the Web supports zooming using gestures. 7603 * 7604 * @param { boolean } zoomAccess {@code true} means the Web supports zooming using gestures; {@code false} otherwise. 7605 * The default value is true. 7606 * @returns { WebAttribute } 7607 * @syscap SystemCapability.Web.Webview.Core 7608 * @crossplatform 7609 * @atomicservice 7610 * @since 11 7611 */ 7612 zoomAccess(zoomAccess: boolean): WebAttribute; 7613 7614 /** 7615 * Sets whether to allow access to geographical locations. 7616 * 7617 * @param { boolean } geolocationAccess - {@code true} means the Web allows access to geographical locations; {@code false} otherwise. 7618 * The default value is true. 7619 * @returns { WebAttribute } 7620 * @syscap SystemCapability.Web.Webview.Core 7621 * @since 8 7622 */ 7623 /** 7624 * Set whether to enable geolocation access. By default, this feature is enabled. 7625 * For details, see Managing Location Permissions. 7626 * 7627 * @param { boolean } geolocationAccess - Whether to enable geolocation access. {@code true} means the Web 7628 * allows access to geographical locations; {@code false} means the 7629 * Web disallows access to geographical locations. The default value is true. 7630 * @returns { WebAttribute } 7631 * @syscap SystemCapability.Web.Webview.Core 7632 * @crossplatform 7633 * @atomicservice 7634 * @since arkts {'1.1':'11', '1.2':'20'} 7635 * @arkts 1.1&1.2 7636 */ 7637 geolocationAccess(geolocationAccess: boolean): WebAttribute; 7638 7639 /** 7640 * Injects the JavaScript object into window and invoke the function in window. 7641 * 7642 * @param { object } javaScriptProxy - The JavaScript object to be injected. 7643 * @returns { WebAttribute } 7644 * @syscap SystemCapability.Web.Webview.Core 7645 * @since 8 7646 */ 7647 /** 7648 * Injects the JavaScript object into window and invoke the function in window. 7649 * 7650 * @param { object } javaScriptProxy - The JavaScript object to be injected. 7651 * @returns { WebAttribute } 7652 * @syscap SystemCapability.Web.Webview.Core 7653 * @since 9 7654 */ 7655 /** 7656 * Injects the JavaScript object into window and invoke the function in window. 7657 * 7658 * @param { object } javaScriptProxy - The JavaScript object to be injected. 7659 * @returns { WebAttribute } 7660 * @syscap SystemCapability.Web.Webview.Core 7661 * @atomicservice 7662 * @since 11 7663 */ 7664 /** 7665 * Registers the supplied ArkTS object in javaScriptProxy into this Web component. 7666 * The object is registered into all frames of the web page, including all frames, using the specified name in javaScriptProxy. 7667 * This allows the methods of the ArkTS object in javaScriptProxy to be accessed from JavaScript. 7668 * 7669 * <p><strong>API Note</strong>: 7670 * <strong>Performance Note</strong>: 7671 * <p>For details about the arkweb rendering framework adaptation solution, 7672 * see [ArkWeb Rendering Framework Adaptation]{@link https://developer.huawei.com/consumer/en/doc/best-practices/bpta-arkweb_rendering_framework} 7673 * </p> 7674 * 7675 * @param { JavaScriptProxy } javaScriptProxy - The ArkTS object in javaScriptProxy will be registered into this Web component, 7676 * and the methods within the methodList of the injected ArkTS object declared in javaScriptProxy can be accessed by JavaScript. 7677 * @returns { WebAttribute } 7678 * @syscap SystemCapability.Web.Webview.Core 7679 * @atomicservice 7680 * @since 12 7681 */ 7682 /** 7683 * Registers the supplied ArkTS object in javaScriptProxy into this Web component. 7684 * The object is registered into all frames of the web page, including all frames, using the specified name in javaScriptProxy. 7685 * This allows the methods of the ArkTS object in javaScriptProxy to be accessed from JavaScript. 7686 * 7687 * <p><strong>API Note</strong>: 7688 * <strong>Performance Note</strong>: 7689 * <p>For details about how to arkWeb rendering framework adaptation solution, 7690 * see [ArkWeb Rendering Framework Adaptation] 7691 * {@link https://developer.huawei.com/consumer/en/doc/best-practices/bpta-arkweb_rendering_framework} 7692 * </p> 7693 * 7694 * @param { JavaScriptProxy } javaScriptProxy - The ArkTS object in javaScriptProxy will be registered into this Web component, 7695 * and the methods within the methodList of the injected ArkTS object declared in javaScriptProxy can be accessed by JavaScript. 7696 * @returns { WebAttribute } 7697 * @syscap SystemCapability.Web.Webview.Core 7698 * @crossplatform 7699 * @atomicservice 7700 * @since 20 7701 */ 7702 javaScriptProxy(javaScriptProxy: JavaScriptProxy): WebAttribute; 7703 7704 /** 7705 * Sets whether the Web should save the password. 7706 * 7707 * @param { boolean } password - {@code true} means the Web can save the password; {@code false} otherwise. 7708 * @returns { WebAttribute } 7709 * @syscap SystemCapability.Web.Webview.Core 7710 * @since 8 7711 * @deprecated since 10 7712 */ 7713 password(password: boolean): WebAttribute; 7714 7715 /** 7716 * Sets the mode of cache in Web. 7717 * 7718 * @param { CacheMode } cacheMode - The cache mode, which can be {@link CacheMode}. 7719 * @returns { WebAttribute } 7720 * @syscap SystemCapability.Web.Webview.Core 7721 * @since 8 7722 */ 7723 /** 7724 * Sets the mode of cache in Web. 7725 * 7726 * @param { CacheMode } cacheMode - The cache mode, which can be {@link CacheMode}. 7727 * @returns { WebAttribute } 7728 * @syscap SystemCapability.Web.Webview.Core 7729 * @atomicservice 7730 * @since 11 7731 */ 7732 /** 7733 * Sets the mode of cache in Web. 7734 * 7735 * @param { CacheMode } cacheMode - The cache mode, which can be {@link CacheMode}. 7736 * @returns { WebAttribute } 7737 * @syscap SystemCapability.Web.Webview.Core 7738 * @crossplatform 7739 * @atomicservice 7740 * @since 18 7741 */ 7742 cacheMode(cacheMode: CacheMode): WebAttribute; 7743 7744 /** 7745 * Sets the dark mode of Web. 7746 * 7747 * @param { WebDarkMode } mode - The dark mode, which can be {@link WebDarkMode}. 7748 * @returns { WebAttribute } 7749 * @syscap SystemCapability.Web.Webview.Core 7750 * @since 9 7751 */ 7752 /** 7753 * Sets the web dark mode. By default, web dark mode is disabled. When it is enabled, 7754 * the Web component enables the dark theme defined for web pages 7755 * if the theme has been defined in prefers-color-scheme of a media query, 7756 * and remains unchanged otherwise. To enable the forcible dark mode, use this API with forceDarkAccess. 7757 * 7758 * @param { WebDarkMode } mode - Web dark mode to set. 7759 * Default value: WebDarkMode.Off. 7760 * @returns { WebAttribute } 7761 * @syscap SystemCapability.Web.Webview.Core 7762 * @atomicservice 7763 * @since 11 7764 */ 7765 darkMode(mode: WebDarkMode): WebAttribute; 7766 7767 /** 7768 * Sets whether to enable forced dark algorithm when the web is in dark mode 7769 * 7770 * @param { boolean } access {@code true} means enable the force dark algorithm; {@code false} otherwise. 7771 * @returns { WebAttribute } 7772 * @syscap SystemCapability.Web.Webview.Core 7773 * @since 9 7774 */ 7775 /** 7776 * Sets whether to enable forcible dark mode for the web page. 7777 * This API is applicable only when dark mode is enabled in {@link darkMode}. 7778 * 7779 * @param { boolean } access Sets whether to enable forcible dark mode for the web page. 7780 * {@code true} means enable forcible dark mode for the web page. ; 7781 * {@code false} means not enable forcible dark mode for the web page. 7782 * The default value is false. 7783 * @returns { WebAttribute } 7784 * @syscap SystemCapability.Web.Webview.Core 7785 * @atomicservice 7786 * @since 11 7787 */ 7788 forceDarkAccess(access: boolean): WebAttribute; 7789 7790 /** 7791 * Sets the media options. 7792 * 7793 * @param { WebMediaOptions } options The media options, which can be {@link WebMediaOptions}. 7794 * @returns { WebAttribute } 7795 * @syscap SystemCapability.Web.Webview.Core 7796 * @since 10 7797 */ 7798 /** 7799 * Sets the web-based media playback policy, including the validity period for automatically resuming a paused web audio, 7800 * and whether the audio of multiple Web instances in an application is exclusive. 7801 * <p><strong>API Note</strong>:<br> 7802 * Audios in the same Web instance are considered as the same audio. 7803 * The media playback policy controls videos with an audio track. 7804 * After the parameter settings are updated, the playback must be started again for the settings to take effect. 7805 * It is recommended that you set the same audioExclusive value for all Web components. 7806 * Audio and video interruption takes effect within an app and between apps, and playback resumption takes effect only between apps. 7807 * </p> 7808 * 7809 * @param { WebMediaOptions } options Set the media policy for the web. 7810 * After updating the attribute parameters, the audio needs to be replayed for it to take effect. 7811 * Default value: {resumeInterval: 0, audioExclusive: true} 7812 * @returns { WebAttribute } 7813 * @syscap SystemCapability.Web.Webview.Core 7814 * @atomicservice 7815 * @since 11 7816 */ 7817 mediaOptions(options: WebMediaOptions): WebAttribute; 7818 7819 /** 7820 * Sets whether the Web should save the table data. 7821 * 7822 * @param { boolean } tableData {@code true} means the Web can save the table data; {@code false} otherwise. 7823 * @returns { WebAttribute } 7824 * @syscap SystemCapability.Web.Webview.Core 7825 * @since 8 7826 * @deprecated since 10 7827 */ 7828 tableData(tableData: boolean): WebAttribute; 7829 7830 /** 7831 * Sets whether the Web access meta 'viewport' in HTML. 7832 * 7833 * @param { boolean } wideViewModeAccess {@code true} means the Web access meta 'viewport' in HTML; {@code false} otherwise. 7834 * @returns { WebAttribute } 7835 * @syscap SystemCapability.Web.Webview.Core 7836 * @since 8 7837 * @deprecated since 10 7838 */ 7839 wideViewModeAccess(wideViewModeAccess: boolean): WebAttribute; 7840 7841 /** 7842 * Sets whether the Web access overview mode. 7843 * 7844 * @param { boolean } overviewModeAccess {@code true} means the Web access overview mode; {@code false} otherwise. 7845 * The default value is true. 7846 * @returns { WebAttribute } 7847 * @syscap SystemCapability.Web.Webview.Core 7848 * @since 8 7849 */ 7850 /** 7851 * Sets whether to load web pages by using the overview mode, which means reducing the content to fit the screen width. 7852 * Currently, only mobile devices are supported. 7853 * 7854 * @param { boolean } overviewModeAccess Whether to load web pages by using the overview mode. 7855 * {@code true} means the Web access overview mode; 7856 * {@code false} means the Web not access overview mode. 7857 * Default value: true. 7858 * @returns { WebAttribute } 7859 * @syscap SystemCapability.Web.Webview.Core 7860 * @atomicservice 7861 * @since 11 7862 */ 7863 overviewModeAccess(overviewModeAccess: boolean): WebAttribute; 7864 7865 /** 7866 * Sets the over-scroll mode for web 7867 * When the scrolling mode is enabled, when the user slides to the edge on the web root page, the web will bounce back 7868 * the interface through elastic animation, and the internal pages on the root page will not trigger the bounce back. 7869 * 7870 * @param { OverScrollMode } mode - The over-scroll mode, which can be {@link OverScrollMode}. 7871 * The default value is OverScrollMode.NEVER. 7872 * @returns { WebAttribute } 7873 * @syscap SystemCapability.Web.Webview.Core 7874 * @atomicservice 7875 * @since 11 7876 */ 7877 overScrollMode(mode: OverScrollMode): WebAttribute; 7878 7879 /** 7880 * Sets the blur on for elements on webview when soft keyboard is hidden manually. 7881 * 7882 * @param { BlurOnKeyboardHideMode } mode - Default value is SILENT. Set BLUR to enable the blur on keyboard hide mode, which can be {@link BlurOnKeyboardHideMode}. 7883 * @returns { WebAttribute } 7884 * @syscap SystemCapability.Web.Webview.Core 7885 * @atomicservice 7886 * @since 14 7887 */ 7888 blurOnKeyboardHideMode(mode: BlurOnKeyboardHideMode): WebAttribute; 7889 7890 /** 7891 * Sets the ratio of the text zoom. 7892 * 7893 * @param { number } textZoomAtio The ratio of the text zoom. The default value is 100, ranging from 1 to +∞. 7894 * @returns { WebAttribute } 7895 * @syscap SystemCapability.Web.Webview.Core 7896 * @since 8 7897 * @deprecated since 9 7898 * @useinstead ohos.web.WebAttribute#textZoomRatio 7899 */ 7900 textZoomAtio(textZoomAtio: number): WebAttribute; 7901 7902 /** 7903 * Sets the ratio of the text zoom. 7904 * 7905 * @param { number } textZoomRatio The ratio of the text zoom. The default value is 100, ranging from 1 to +∞. 7906 * @returns { WebAttribute } 7907 * @syscap SystemCapability.Web.Webview.Core 7908 * @since 9 7909 */ 7910 /** 7911 * Sets the ratio of the text zoom. 7912 * 7913 * @param { number } textZoomRatio The ratio of the text zoom. The default value is 100, ranging from 1 to +∞. 7914 * @returns { WebAttribute } 7915 * @syscap SystemCapability.Web.Webview.Core 7916 * @atomicservice 7917 * @since 11 7918 */ 7919 textZoomRatio(textZoomRatio: number): WebAttribute; 7920 7921 /** 7922 * Sets whether the Web access the database. 7923 * 7924 * @param { boolean } databaseAccess {@code true} means the Web access the database; {@code false} otherwise. 7925 * The default value is false. 7926 * @returns { WebAttribute } 7927 * @syscap SystemCapability.Web.Webview.Core 7928 * @since 8 7929 */ 7930 /** 7931 * Sets whether to enable database access. By default, this feature is disabled. 7932 * 7933 * 7934 * @param { boolean } databaseAccess - Whether to enable database access. {@code true} means to enable 7935 * database access; {@code false} means to disable database access. 7936 * The default value is false. 7937 * @returns { WebAttribute } 7938 * @syscap SystemCapability.Web.Webview.Core 7939 * @atomicservice 7940 * @since arkts {'1.1':'11', '1.2':'20'} 7941 * @arkts 1.1&1.2 7942 */ 7943 databaseAccess(databaseAccess: boolean): WebAttribute; 7944 7945 /** 7946 * Sets the initial scale for the Web. 7947 * 7948 * @param { number } percent the initial scale for the Web. 7949 * @returns { WebAttribute } 7950 * @syscap SystemCapability.Web.Webview.Core 7951 * @since 9 7952 */ 7953 /** 7954 * Sets the initial scale for the Web. 7955 * 7956 * @param { number } percent the initial scale for the Web. 7957 * Value range: (0, 1000]. 7958 * Default value: 100. 7959 * @returns { WebAttribute } 7960 * @syscap SystemCapability.Web.Webview.Core 7961 * @atomicservice 7962 * @since 11 7963 */ 7964 initialScale(percent: number): WebAttribute; 7965 7966 /** 7967 * Sets the Web's user agent. 7968 * 7969 * @param { string } userAgent The Web's user agent. 7970 * @returns { WebAttribute } 7971 * @syscap SystemCapability.Web.Webview.Core 7972 * @since 8 7973 * @deprecated since 10 7974 * @useinstead ohos.web.webview.webview.WebviewController#setCustomUserAgent 7975 */ 7976 userAgent(userAgent: string): WebAttribute; 7977 7978 /** 7979 * Sets whether the viewport property of the meta tag is enabled. 7980 * 7981 * <p><strong>API Note</strong>:<br> 7982 * If the device is 2-in-1, the viewport property is not supported. This means that, 7983 * regardless of whether this parameter is set to true or false, 7984 * the viewport property will not be parsed and a default layout will be used.<br> 7985 * If the device is a tablet, the viewport-fit property of the meta tag is parsed regardless of 7986 * whether this parameter is set to true or false. When viewport-fit is set to cover, 7987 * the size of the safe area can be obtained through the CSS attribute.<br> 7988 * The viewport parameter of the meta tag on the frontend HTML page is enabled or 7989 * disabled based on whether User-Agent contains the Mobile field. 7990 * If a User-Agent does not contain the Mobile field, the viewport property in the meta tag is disabled by default. 7991 * In this case, you can explicitly set the metaViewport property to true to overwrite the disabled state. 7992 * </p> 7993 * 7994 * @param { boolean } enabled Whether the viewport property of the meta tag is enabled. 7995 * {@code true} means support the viewport attribute of the meta tag, 7996 * the viewport property of the meta tag is not enabled. 7997 * This means that the property will not be parsed and a default layout will be used.; 7998 * {@code false} means not support the viewport attribute of the meta tag, 7999 * the viewport property of the meta tag is enabled. 8000 * This means that the property will be parsed and used for the layout. 8001 * Default value: true. 8002 * @returns { WebAttribute } 8003 * @syscap SystemCapability.Web.Webview.Core 8004 * @atomicservice 8005 * @since 12 8006 */ 8007 metaViewport(enabled: boolean): WebAttribute; 8008 8009 /** 8010 * Triggered at the end of web page loading. 8011 * This callback is only invoked for the main frame and not for subframes. 8012 * 8013 * @param { function } callback The triggered function at the end of web page loading. 8014 * @returns { WebAttribute } The WebAttribute object representing the attributes of the web page. 8015 * @syscap SystemCapability.Web.Webview.Core 8016 * @since 8 8017 */ 8018 /** 8019 * Triggered at the end of web page loading. 8020 * This callback is only invoked for the main frame and not for subframes. 8021 * 8022 * @param { function } callback The triggered function at the end of web page loading. 8023 * @returns { WebAttribute } The WebAttribute object representing the attributes of the web page. 8024 * @syscap SystemCapability.Web.Webview.Core 8025 * @crossplatform 8026 * @since 10 8027 */ 8028 /** 8029 * Triggered at the end of web page loading. 8030 * This callback is only invoked for the main frame and not for subframes. 8031 * 8032 * @param { function } callback The triggered function at the end of web page loading. 8033 * @returns { WebAttribute } The WebAttribute object representing the attributes of the web page. 8034 * @syscap SystemCapability.Web.Webview.Core 8035 * @crossplatform 8036 * @atomicservice 8037 * @since 11 8038 */ 8039 /** 8040 * Triggered at the end of web page loading. 8041 * This callback is only invoked for the main frame and not for subframes. 8042 * 8043 * @param { Callback<OnPageEndEvent> } callback The triggered function at the end of web page loading. 8044 * @returns { WebAttribute } The WebAttribute object representing the attributes of the web page. 8045 * @syscap SystemCapability.Web.Webview.Core 8046 * @crossplatform 8047 * @atomicservice 8048 * @since arkts {'1.1':'12', '1.2':'20'} 8049 * @arkts 1.1&1.2 8050 */ 8051 onPageEnd(callback: Callback<OnPageEndEvent>): WebAttribute; 8052 8053 /** 8054 * Triggered at the begin of web page loading. 8055 * 8056 * @param { function } callback The triggered function at the begin of web page loading. 8057 * @returns { WebAttribute } 8058 * @syscap SystemCapability.Web.Webview.Core 8059 * @since 8 8060 */ 8061 /** 8062 * Triggered at the begin of web page loading. 8063 * 8064 * @param { function } callback The triggered function at the begin of web page loading. 8065 * @returns { WebAttribute } 8066 * @syscap SystemCapability.Web.Webview.Core 8067 * @crossplatform 8068 * @since 10 8069 */ 8070 /** 8071 * Triggered at the begin of web page loading. 8072 * 8073 * @param { function } callback The triggered function at the begin of web page loading. 8074 * @returns { WebAttribute } 8075 * @syscap SystemCapability.Web.Webview.Core 8076 * @crossplatform 8077 * @atomicservice 8078 * @since 11 8079 */ 8080 /** 8081 * Called when the web page starts to be loaded. 8082 * This API is called only for the main frame, and not for the iframe or frameset content. 8083 * 8084 * @param { Callback<OnPageBeginEvent> } callback The triggered function at the begin of web page loading. 8085 * @returns { WebAttribute } 8086 * @syscap SystemCapability.Web.Webview.Core 8087 * @crossplatform 8088 * @atomicservice 8089 * @since arkts {'1.1':'12', '1.2':'20'} 8090 * @arkts 1.1&1.2 8091 */ 8092 onPageBegin(callback: Callback<OnPageBeginEvent>): WebAttribute; 8093 8094 /** 8095 * Triggered at the begin of web page loading. This method is called once for each main frame load. Embedded frame 8096 * changes, i.e. clicking a link whose target is an iframe and fragment navigations (navigations to #fragment_id) 8097 * will not trigger this callback. 8098 * 8099 * <p><strong>API Note</strong>:<br> 8100 * Different from onPageBegin, onLoadStarted is triggered only once if the mainframe is automatically redirected 8101 * before the page is completely loaded. OnPageBegin is triggered every navigation. 8102 * </p> 8103 * 8104 * @param { Callback<OnLoadStartedEvent> } callback The triggered function at the begin of web page loading. 8105 * @returns { WebAttribute } 8106 * @syscap SystemCapability.Web.Webview.Core 8107 * @since 20 8108 */ 8109 onLoadStarted(callback: Callback<OnLoadStartedEvent>): WebAttribute; 8110 8111 /** 8112 * Notify the host application that a page has finished loading. This method is called only for main frame. 8113 * 8114 * <p><strong>API Note</strong>:<br> 8115 * Different from onPageEnd, fragment navigation also triggers onLoadFinished. 8116 * </p> 8117 * 8118 * @param { Callback<OnLoadFinishedEvent> } callback The triggered function at the end of web page loading. 8119 * @returns { WebAttribute } 8120 * @syscap SystemCapability.Web.Webview.Core 8121 * @since 20 8122 */ 8123 onLoadFinished(callback: Callback<OnLoadFinishedEvent>): WebAttribute; 8124 8125 /** 8126 * Triggered when the page loading progress changes. 8127 * 8128 * @param { function } callback The triggered function when the page loading progress changes. 8129 * @returns { WebAttribute } 8130 * @syscap SystemCapability.Web.Webview.Core 8131 * @since 8 8132 */ 8133 /** 8134 * Triggered when the page loading progress changes. 8135 * 8136 * @param { function } callback The triggered function when the page loading progress changes. 8137 * @returns { WebAttribute } 8138 * @syscap SystemCapability.Web.Webview.Core 8139 * @crossplatform 8140 * @atomicservice 8141 * @since 11 8142 */ 8143 /** 8144 * Triggered when the page loading progress changes. 8145 * 8146 * @param { Callback<OnProgressChangeEvent> } callback The triggered function when the page loading progress changes. 8147 * @returns { WebAttribute } 8148 * @syscap SystemCapability.Web.Webview.Core 8149 * @crossplatform 8150 * @atomicservice 8151 * @since arkts {'1.1':'12', '1.2':'20'} 8152 * @arkts 1.1&1.2 8153 */ 8154 onProgressChange(callback: Callback<OnProgressChangeEvent>): WebAttribute; 8155 8156 /** 8157 * Triggered when the title of the main application document changes. 8158 * 8159 * @param { function } callback The triggered function when the title of the main application document changes. 8160 * @returns { WebAttribute } 8161 * @syscap SystemCapability.Web.Webview.Core 8162 * @since 8 8163 */ 8164 /** 8165 * Triggered when the title of the main application document changes. 8166 * 8167 * @param { function } callback The triggered function when the title of the main application document changes. 8168 * @returns { WebAttribute } 8169 * @syscap SystemCapability.Web.Webview.Core 8170 * @crossplatform 8171 * @atomicservice 8172 * @since 11 8173 */ 8174 /** 8175 * Notifies the application that the title has changed. 8176 * If the page being loaded does not specify a title via the <title> element, 8177 * ArkWeb will generate a title baseed on the URL and return it to the application. 8178 * 8179 * @param { Callback<OnTitleReceiveEvent> } callback The triggered function when the title of the main application document changes. 8180 * @returns { WebAttribute } 8181 * @syscap SystemCapability.Web.Webview.Core 8182 * @crossplatform 8183 * @atomicservice 8184 * @since 12 8185 */ 8186 onTitleReceive(callback: Callback<OnTitleReceiveEvent>): WebAttribute; 8187 8188 /** 8189 * Triggered when requesting to hide the geolocation. 8190 * 8191 * @param { function } callback The triggered function when requesting to hide the geolocation permission. 8192 * @returns { WebAttribute } 8193 * @syscap SystemCapability.Web.Webview.Core 8194 * @since 8 8195 */ 8196 /** 8197 * Called to notify the user that the request for obtaining the geolocation information received 8198 * when {@link onGeolocationShow} is called has been canceled. 8199 * 8200 * @param { function } callback - Callback invoked when the request for obtaining geolocation information has been canceled. 8201 * @returns { WebAttribute } 8202 * @syscap SystemCapability.Web.Webview.Core 8203 * @crossplatform 8204 * @atomicservice 8205 * @since arkts {'1.1':'11', '1.2':'20'} 8206 * @arkts 1.1&1.2 8207 */ 8208 onGeolocationHide(callback: () => void): WebAttribute; 8209 8210 /** 8211 * Triggered when requesting to show the geolocation permission. 8212 * 8213 * @param { function } callback The triggered function when requesting to show the geolocation permission. 8214 * @returns { WebAttribute } 8215 * @syscap SystemCapability.Web.Webview.Core 8216 * @since 8 8217 */ 8218 /** 8219 * Triggered when requesting to show the geolocation permission. 8220 * 8221 * @param { function } callback The triggered function when requesting to show the geolocation permission. 8222 * @returns { WebAttribute } 8223 * @syscap SystemCapability.Web.Webview.Core 8224 * @crossplatform 8225 * @atomicservice 8226 * @since 11 8227 */ 8228 /** 8229 * Called when a request to obtain the geolocation information is received. 8230 * @param { Callback<OnGeolocationShowEvent> } callback - Callback invoked when a request to obtain the geolocation 8231 * information is received. 8232 * @returns { WebAttribute } 8233 * @syscap SystemCapability.Web.Webview.Core 8234 * @crossplatform 8235 * @atomicservice 8236 * @since arkts {'1.1':'12', '1.2':'20'} 8237 * @arkts 1.1&1.2 8238 */ 8239 onGeolocationShow(callback: Callback<OnGeolocationShowEvent>): WebAttribute; 8240 8241 /** 8242 * Triggered when the Web gets the focus. 8243 * 8244 * @param { function } callback The triggered function when the Web gets the focus. 8245 * @returns { WebAttribute } 8246 * @syscap SystemCapability.Web.Webview.Core 8247 * @since 8 8248 */ 8249 /** 8250 * Triggered when the Web gets the focus. 8251 * 8252 * @param { function } callback The triggered function when the Web gets the focus. 8253 * @returns { WebAttribute } 8254 * @syscap SystemCapability.Web.Webview.Core 8255 * @atomicservice 8256 * @since 11 8257 */ 8258 onRequestSelected(callback: () => void): WebAttribute; 8259 8260 /** 8261 * Triggered when the Web wants to display a JavaScript alert() dialog. 8262 * 8263 * @param { function } callback The triggered function when the web page wants to display a JavaScript alert() dialog. 8264 * @returns { WebAttribute } 8265 * @syscap SystemCapability.Web.Webview.Core 8266 * @since 8 8267 */ 8268 /** 8269 * Triggered when the Web wants to display a JavaScript alert() dialog. 8270 * 8271 * @param { function } callback The triggered function when the web page wants to display a JavaScript alert() dialog. 8272 * @returns { WebAttribute } 8273 * @syscap SystemCapability.Web.Webview.Core 8274 * @crossplatform 8275 * @atomicservice 8276 * @since 11 8277 */ 8278 /** 8279 * Triggered when the Web wants to display a JavaScript alert() dialog. 8280 * 8281 * @param { Callback<OnAlertEvent, boolean> } callback The triggered function when the web page wants to display a JavaScript alert() dialog. 8282 * {@code true} means the application can invoke custom pop-up dialog capabilities (with confirmation and cancellation buttons). 8283 * Developers need to use the JsResult interface to notify the web component whether to leave the current page 8284 * according to the user's choice. 8285 * {@code false} means the pop-up processing result is considered as cancelled. 8286 * @returns { WebAttribute } 8287 * @syscap SystemCapability.Web.Webview.Core 8288 * @crossplatform 8289 * @atomicservice 8290 * @since 12 8291 */ 8292 onAlert(callback: Callback<OnAlertEvent, boolean>): WebAttribute; 8293 8294 /** 8295 * Triggered when the Web wants to confirm navigation from JavaScript onbeforeunload. 8296 * 8297 * @param { function } callback The triggered function when the web page wants to confirm navigation from JavaScript onbeforeunload. 8298 * @returns { WebAttribute } 8299 * @syscap SystemCapability.Web.Webview.Core 8300 * @since 8 8301 */ 8302 /** 8303 * Triggered when the Web wants to confirm navigation from JavaScript onbeforeunload. 8304 * 8305 * @param { function } callback The triggered function when the web page wants to confirm navigation from JavaScript onbeforeunload. 8306 * @returns { WebAttribute } 8307 * @syscap SystemCapability.Web.Webview.Core 8308 * @atomicservice 8309 * @since 11 8310 */ 8311 /** 8312 * Triggered when the Web wants to confirm navigation from JavaScript onbeforeunload. 8313 * 8314 * @param { Callback<OnBeforeUnloadEvent, boolean> } callback The triggered function when the web page wants to confirm navigation from JavaScript onbeforeunload. 8315 * @returns { WebAttribute } 8316 * @syscap SystemCapability.Web.Webview.Core 8317 * @atomicservice 8318 * @since 12 8319 */ 8320 /** 8321 * Triggered when the Web wants to confirm navigation from JavaScript onbeforeunload. 8322 * 8323 * @param { Callback<OnBeforeUnloadEvent, boolean> } callback The triggered function when the web page wants to confirm navigation from JavaScript onbeforeunload. 8324 * @returns { WebAttribute } 8325 * @syscap SystemCapability.Web.Webview.Core 8326 * @crossplatform 8327 * @atomicservice 8328 * @since 18 8329 */ 8330 onBeforeUnload(callback: Callback<OnBeforeUnloadEvent, boolean>): WebAttribute; 8331 8332 /** 8333 * Triggered when the web page wants to display a JavaScript confirm() dialog. 8334 * 8335 * @param { function } callback The Triggered function when the web page wants to display a JavaScript confirm() dialog. 8336 * @returns { WebAttribute } 8337 * @syscap SystemCapability.Web.Webview.Core 8338 * @since 8 8339 */ 8340 /** 8341 * Triggered when the web page wants to display a JavaScript confirm() dialog. 8342 * 8343 * @param { function } callback The Triggered function when the web page wants to display a JavaScript confirm() dialog. 8344 * @returns { WebAttribute } 8345 * @syscap SystemCapability.Web.Webview.Core 8346 * @crossplatform 8347 * @atomicservice 8348 * @since 11 8349 */ 8350 /** 8351 * Triggered when the web page wants to display a JavaScript confirm() dialog. 8352 * 8353 * @param { Callback<OnConfirmEvent, boolean> } callback The triggered function when the web page wants to display a JavaScript confirm() dialog. 8354 * {@code true} means the application can call the custom pop-up capability (including confirmation and cancellation), and needs to call JsResult 8355 * to notify the Web component whether to leave the current page based on the user's confirmation or cancellation operation. 8356 * {@code false} means the custom pop-up drawn in the function is invalid. 8357 * @returns { WebAttribute } 8358 * @syscap SystemCapability.Web.Webview.Core 8359 * @crossplatform 8360 * @atomicservice 8361 * @since arkts {'1.1':'12', '1.2':'20'} 8362 * @arkts 1.1&1.2 8363 */ 8364 onConfirm(callback: Callback<OnConfirmEvent, boolean>): WebAttribute; 8365 8366 /** 8367 * Triggered when the web page wants to display a JavaScript prompt() dialog. 8368 * 8369 * @param { function } callback The Triggered function when the web page wants to display a JavaScript prompt() dialog. 8370 * @returns { WebAttribute } 8371 * @syscap SystemCapability.Web.Webview.Core 8372 * @since 9 8373 */ 8374 /** 8375 * Triggered when the web page wants to display a JavaScript prompt() dialog. 8376 * 8377 * @param { function } callback The Triggered function when the web page wants to display a JavaScript prompt() dialog. 8378 * @returns { WebAttribute } 8379 * @syscap SystemCapability.Web.Webview.Core 8380 * @crossplatform 8381 * @atomicservice 8382 * @since 11 8383 */ 8384 /** 8385 * Triggered when the web page wants to display a JavaScript prompt() dialog. 8386 * 8387 * @param { Callback<OnPromptEvent, boolean> } callback The triggered function when the web page wants to display a JavaScript prompt() dialog. 8388 * {@code true} means the application can call the custom pop-up window capability (including confirmation, cancellation, and input),and needs to 8389 * call JsResult to notify the Web component of the final processing result based on the user's confirmation or cancellation operation. 8390 * {@code false} means the pop-up window processing result is considered as a cancellation. 8391 * @returns { WebAttribute } 8392 * @syscap SystemCapability.Web.Webview.Core 8393 * @crossplatform 8394 * @atomicservice 8395 * @since arkts {'1.1':'12', '1.2':'20'} 8396 * @arkts 1.1&1.2 8397 */ 8398 onPrompt(callback: Callback<OnPromptEvent, boolean>): WebAttribute; 8399 8400 /** 8401 * Triggered when the web page receives a JavaScript console message. 8402 * 8403 * @param { function } callback The triggered function when the web page receives a JavaScript console message. 8404 * @returns { WebAttribute } 8405 * @syscap SystemCapability.Web.Webview.Core 8406 * @since 8 8407 */ 8408 /** 8409 * Triggered when the web page receives a JavaScript console message. 8410 * 8411 * @param { function } callback The triggered function when the web page receives a JavaScript console message. 8412 * @returns { WebAttribute } 8413 * @syscap SystemCapability.Web.Webview.Core 8414 * @crossplatform 8415 * @atomicservice 8416 * @since 11 8417 */ 8418 /** 8419 * Triggered when the web page receives a JavaScript console message. 8420 * 8421 * @param { Callback<OnConsoleEvent, boolean> } callback The triggered function when the web page receives a JavaScript console message. 8422 * {@code true} means the message will no longer be printed to the console. 8423 * {@code false} means it will still be printed to the console. 8424 * @returns { WebAttribute } 8425 * @syscap SystemCapability.Web.Webview.Core 8426 * @crossplatform 8427 * @atomicservice 8428 * @since 12 8429 */ 8430 onConsole(callback: Callback<OnConsoleEvent, boolean>): WebAttribute; 8431 8432 /** 8433 * Triggered when the web page receives a web resource loading error. 8434 * 8435 * @param { function } callback The triggered function when the web page receives a web resource loading error. 8436 * @returns { WebAttribute } 8437 * @syscap SystemCapability.Web.Webview.Core 8438 * @since 8 8439 */ 8440 /** 8441 * Triggered when the web page receives a web resource loading error. 8442 * 8443 * @param { function } callback The triggered function when the web page receives a web resource loading error. 8444 * @returns { WebAttribute } 8445 * @syscap SystemCapability.Web.Webview.Core 8446 * @crossplatform 8447 * @since 10 8448 */ 8449 /** 8450 * Triggered when the web page receives a web resource loading error. 8451 * 8452 * @param { function } callback The triggered function when the web page receives a web resource loading error. 8453 * @returns { WebAttribute } 8454 * @syscap SystemCapability.Web.Webview.Core 8455 * @crossplatform 8456 * @atomicservice 8457 * @since 11 8458 */ 8459 /** 8460 * Triggered when the web page receives a web resource loading error. 8461 * 8462 * @param { Callback<OnErrorReceiveEvent> } callback The triggered function when the web page receives a web resource loading error. 8463 * @returns { WebAttribute } 8464 * @syscap SystemCapability.Web.Webview.Core 8465 * @crossplatform 8466 * @atomicservice 8467 * @since 12 8468 */ 8469 onErrorReceive(callback: Callback<OnErrorReceiveEvent>): WebAttribute; 8470 8471 /** 8472 * Triggered when the web page receives a web resource loading HTTP error. 8473 * 8474 * @param { function } callback The triggered function when the web page receives a web resource loading HTTP error. 8475 * @returns { WebAttribute } 8476 * @syscap SystemCapability.Web.Webview.Core 8477 * @since 8 8478 */ 8479 /** 8480 * Triggered when the web page receives a web resource loading HTTP error. 8481 * 8482 * @param { function } callback The triggered function when the web page receives a web resource loading HTTP error. 8483 * @returns { WebAttribute } 8484 * @syscap SystemCapability.Web.Webview.Core 8485 * @crossplatform 8486 * @atomicservice 8487 * @since 11 8488 */ 8489 /** 8490 * Triggered when the web page receives a web resource loading HTTP error. 8491 * 8492 * @param { Callback<OnHttpErrorReceiveEvent> } callback The triggered function when the web page receives a web resource loading HTTP error. 8493 * @returns { WebAttribute } 8494 * @syscap SystemCapability.Web.Webview.Core 8495 * @crossplatform 8496 * @atomicservice 8497 * @since 12 8498 */ 8499 onHttpErrorReceive(callback: Callback<OnHttpErrorReceiveEvent>): WebAttribute; 8500 8501 /** 8502 * Triggered when the web page's document resource error. 8503 * <p><strong>API Note</strong>:<br> 8504 * This only triggered for main frame. 8505 * </p> 8506 * 8507 * @param { OnOverrideErrorPageCallback } callback The triggered function when the 8508 * web page's document resource error. 8509 * @returns { WebAttribute } 8510 * @syscap SystemCapability.Web.Webview.Core 8511 * @since 20 8512 */ 8513 onOverrideErrorPage(callback: OnOverrideErrorPageCallback): WebAttribute; 8514 8515 /** 8516 * Triggered when starting to download. 8517 * 8518 * @param { function } callback The triggered function when starting to download. 8519 * @returns { WebAttribute } 8520 * @syscap SystemCapability.Web.Webview.Core 8521 * @since 8 8522 */ 8523 /** 8524 * Triggered when starting to download. 8525 * 8526 * @param { function } callback The triggered function when starting to download. 8527 * @returns { WebAttribute } 8528 * @syscap SystemCapability.Web.Webview.Core 8529 * @crossplatform 8530 * @atomicservice 8531 * @since 11 8532 */ 8533 /** 8534 * Triggered when starting to download. 8535 * 8536 * @param { Callback<OnDownloadStartEvent> } callback The triggered function when starting to download. 8537 * @returns { WebAttribute } 8538 * @syscap SystemCapability.Web.Webview.Core 8539 * @crossplatform 8540 * @atomicservice 8541 * @since 12 8542 */ 8543 onDownloadStart(callback: Callback<OnDownloadStartEvent>): WebAttribute; 8544 8545 /** 8546 * Triggered when the Web page refreshes accessed history. 8547 * 8548 * @param { function } callback The triggered callback when the Web page refreshes accessed history. 8549 * @returns { WebAttribute } 8550 * @syscap SystemCapability.Web.Webview.Core 8551 * @since 8 8552 */ 8553 /** 8554 * Triggered when the Web page refreshes accessed history. 8555 * 8556 * @param { function } callback The triggered callback when the Web page refreshes accessed history. 8557 * @returns { WebAttribute } 8558 * @syscap SystemCapability.Web.Webview.Core 8559 * @atomicservice 8560 * @since 11 8561 */ 8562 /** 8563 * Triggered when the Web page refreshes accessed history. 8564 * 8565 * @param { Callback<OnRefreshAccessedHistoryEvent> } callback The triggered callback when the Web page refreshes accessed history. 8566 * @returns { WebAttribute } 8567 * @syscap SystemCapability.Web.Webview.Core 8568 * @atomicservice 8569 * @since 12 8570 */ 8571 /** 8572 * Triggered when the Web page refreshes accessed history. 8573 * 8574 * @param { Callback<OnRefreshAccessedHistoryEvent> } callback The triggered callback when the Web page refreshes accessed history. 8575 * @returns { WebAttribute } 8576 * @syscap SystemCapability.Web.Webview.Core 8577 * @crossplatform 8578 * @atomicservice 8579 * @since 18 8580 */ 8581 onRefreshAccessedHistory(callback: Callback<OnRefreshAccessedHistoryEvent>): WebAttribute; 8582 8583 /** 8584 * Triggered when the URL loading is intercepted. 8585 * 8586 * @param { function } callback The triggered callback when the URL loading is intercepted. 8587 * @returns { WebAttribute } 8588 * @syscap SystemCapability.Web.Webview.Core 8589 * @since 8 8590 * @deprecated since 10 8591 * @useinstead ohos.web.WebAttribute#onLoadIntercept 8592 */ 8593 onUrlLoadIntercept(callback: (event?: { data: string | WebResourceRequest }) => boolean): WebAttribute; 8594 8595 /** 8596 * Triggered when the Web page receives an ssl Error. 8597 * 8598 * @param { function } callback The triggered callback when the Web page receives an ssl Error. 8599 * @returns { WebAttribute } 8600 * @syscap SystemCapability.Web.Webview.Core 8601 * @since 8 8602 * @deprecated since 9 8603 * @useinstead ohos.web.WebAttribute#onSslErrorEventReceive 8604 */ 8605 onSslErrorReceive(callback: (event?: { handler: Function, error: object }) => void): WebAttribute; 8606 8607 /** 8608 * Triggered when the render process exits. 8609 * 8610 * @param { function } callback The triggered when the render process exits. 8611 * @returns { WebAttribute } 8612 * @syscap SystemCapability.Web.Webview.Core 8613 * @since 9 8614 */ 8615 /** 8616 * Triggered when the render process exits. 8617 * 8618 * @param { function } callback The triggered when the render process exits. 8619 * @returns { WebAttribute } 8620 * @syscap SystemCapability.Web.Webview.Core 8621 * @atomicservice 8622 * @since 11 8623 */ 8624 /** 8625 * Triggered when the render process exits. 8626 * Multiple Web components may share a single rendering process, and each affected Web component will trigger the callback. 8627 * When the application handles this callback, it can call the related interface of the bound webviewController to 8628 * restore the page. Such as {@link refresh}, {@link loadUrl}, etc. 8629 * For details of component lifecycle callback, please refer to the lifecycle of Web components. 8630 * @param { Callback<OnRenderExitedEvent> } callback The triggered when the render process exits. 8631 * @returns { WebAttribute } 8632 * @syscap SystemCapability.Web.Webview.Core 8633 * @atomicservice 8634 * @since 12 8635 */ 8636 onRenderExited(callback: Callback<OnRenderExitedEvent>): WebAttribute; 8637 8638 /** 8639 * Triggered when the file selector shows. 8640 * 8641 * @param { function } callback The triggered when the file selector shows. 8642 * @returns { WebAttribute } 8643 * @syscap SystemCapability.Web.Webview.Core 8644 * @since 9 8645 */ 8646 /** 8647 * Triggered when the file selector shows. 8648 * 8649 * @param { function } callback The triggered when the file selector shows. 8650 * @returns { WebAttribute } 8651 * @syscap SystemCapability.Web.Webview.Core 8652 * @crossplatform 8653 * @atomicservice 8654 * @since 11 8655 */ 8656 /** 8657 * Triggered when the file selector shows. 8658 * Call this function to handle HTML forms with a "file" input type. If this function is not called or returns false, 8659 * the web component provides the default "select file" handling interface. If it returns true, the application can customize 8660 * the "select file" response behavior. 8661 * 8662 * @param { Callback<OnShowFileSelectorEvent, boolean> } callback The triggered when the file selector shows. 8663 * {@code true} means the user can call the system-provided pop-up window capability. 8664 * {@code false} means the custom pop-up window drawn in the function is invalid. 8665 * @returns { WebAttribute } 8666 * @syscap SystemCapability.Web.Webview.Core 8667 * @crossplatform 8668 * @atomicservice 8669 * @since arkts {'1.1':'12', '1.2':'20'} 8670 * @arkts 1.1&1.2 8671 */ 8672 onShowFileSelector(callback: Callback<OnShowFileSelectorEvent, boolean>): WebAttribute; 8673 8674 /** 8675 * Triggered when the render process exits. 8676 * 8677 * @param { function } callback The triggered when the render process exits. 8678 * @returns { WebAttribute } 8679 * @syscap SystemCapability.Web.Webview.Core 8680 * @since 8 8681 * @deprecated since 9 8682 * @useinstead ohos.web.WebAttribute#onRenderExited 8683 */ 8684 onRenderExited(callback: (event?: { detail: object }) => boolean): WebAttribute; 8685 8686 /** 8687 * Triggered when the file selector shows. 8688 * 8689 * @param { function } callback The triggered when the file selector shows. 8690 * @returns { WebAttribute } 8691 * @syscap SystemCapability.Web.Webview.Core 8692 * @since 8 8693 * @deprecated since 9 8694 * @useinstead ohos.web.WebAttribute#onShowFileSelector 8695 */ 8696 onFileSelectorShow(callback: (event?: { callback: Function, fileSelector: object }) => void): WebAttribute; 8697 8698 /** 8699 * Triggered when the url loading. 8700 * 8701 * @param { function } callback The triggered when the url loading. 8702 * @returns { WebAttribute } 8703 * @syscap SystemCapability.Web.Webview.Core 8704 * @since 9 8705 */ 8706 /** 8707 * Triggered when the url loading. 8708 * 8709 * @param { function } callback The triggered when the url loading. 8710 * @returns { WebAttribute } 8711 * @syscap SystemCapability.Web.Webview.Core 8712 * @atomicservice 8713 * @since 11 8714 */ 8715 /** 8716 * Triggered when the url loading. 8717 * 8718 * @param { Callback<OnResourceLoadEvent> } callback The triggered when the url loading. 8719 * @returns { WebAttribute } 8720 * @syscap SystemCapability.Web.Webview.Core 8721 * @atomicservice 8722 * @since 12 8723 */ 8724 onResourceLoad(callback: Callback<OnResourceLoadEvent>): WebAttribute; 8725 8726 /** 8727 * Triggered when the web component exit the full screen mode. 8728 * 8729 * @param { function } callback The triggered function when the web component exit the full screen mode. 8730 * @returns { WebAttribute } 8731 * @syscap SystemCapability.Web.Webview.Core 8732 * @since 9 8733 */ 8734 /** 8735 * Triggered when the web component exit the full screen mode. 8736 * 8737 * @param { function } callback The triggered function when the web component exit the full screen mode. 8738 * @returns { WebAttribute } 8739 * @syscap SystemCapability.Web.Webview.Core 8740 * @atomicservice 8741 * @since 11 8742 */ 8743 /** 8744 * Triggered when the web component exit the full screen mode. 8745 * 8746 * @param { function } callback The triggered function when the web component exit the full screen mode. 8747 * @returns { WebAttribute } 8748 * @syscap SystemCapability.Web.Webview.Core 8749 * @crossplatform 8750 * @atomicservice 8751 * @since 18 8752 */ 8753 onFullScreenExit(callback: () => void): WebAttribute; 8754 8755 /** 8756 * Triggered when the web component enter the full screen mode. 8757 * 8758 * @param { function } callback The triggered function when the web component enter the full screen mode. 8759 * @returns { WebAttribute } 8760 * @syscap SystemCapability.Web.Webview.Core 8761 * @since 9 8762 */ 8763 /** 8764 * Triggered when the web component enter the full screen mode. 8765 * 8766 * @param { function } callback The triggered function when the web component enter the full screen mode. 8767 * @returns { WebAttribute } 8768 * @syscap SystemCapability.Web.Webview.Core 8769 * @atomicservice 8770 * @since 11 8771 */ 8772 /** 8773 * Triggered when the web component enter the full screen mode. 8774 * 8775 * @param { OnFullScreenEnterCallback } callback - The triggered function when the web component enter the full screen mode. 8776 * @returns { WebAttribute } 8777 * @syscap SystemCapability.Web.Webview.Core 8778 * @atomicservice 8779 * @since 12 8780 */ 8781 /** 8782 * Triggered when the web component enter the full screen mode. 8783 * 8784 * @param { OnFullScreenEnterCallback } callback - The triggered function when the web component enter the full screen mode. 8785 * @returns { WebAttribute } 8786 * @syscap SystemCapability.Web.Webview.Core 8787 * @crossplatform 8788 * @atomicservice 8789 * @since 18 8790 */ 8791 onFullScreenEnter(callback: OnFullScreenEnterCallback): WebAttribute; 8792 8793 /** 8794 * Triggered when the scale of WebView changed. 8795 * 8796 * @param { function } callback The triggered when the scale of WebView changed. 8797 * @returns { WebAttribute } 8798 * @syscap SystemCapability.Web.Webview.Core 8799 * @since 9 8800 */ 8801 /** 8802 * Triggered when the scale of WebView changed. 8803 * 8804 * @param { function } callback The triggered when the scale of WebView changed. 8805 * @returns { WebAttribute } 8806 * @syscap SystemCapability.Web.Webview.Core 8807 * @crossplatform 8808 * @atomicservice 8809 * @since 11 8810 */ 8811 /** 8812 * Triggered when the scale of WebView changed. 8813 * 8814 * @param { Callback<OnScaleChangeEvent> } callback The triggered when the scale of WebView changed. 8815 * @returns { WebAttribute } 8816 * @syscap SystemCapability.Web.Webview.Core 8817 * @crossplatform 8818 * @atomicservice 8819 * @since 12 8820 */ 8821 onScaleChange(callback: Callback<OnScaleChangeEvent>): WebAttribute; 8822 8823 /** 8824 * Triggered when the browser needs credentials from the user. 8825 * 8826 * @param { function } callback The triggered when the browser needs credentials from the user. 8827 * @returns { WebAttribute } 8828 * @syscap SystemCapability.Web.Webview.Core 8829 * @since 9 8830 */ 8831 /** 8832 * Triggered when the browser needs credentials from the user. 8833 * 8834 * @param { function } callback The triggered when the browser needs credentials from the user. 8835 * @returns { WebAttribute } 8836 * @syscap SystemCapability.Web.Webview.Core 8837 * @crossplatform 8838 * @atomicservice 8839 * @since 11 8840 */ 8841 /** 8842 * Triggered when the browser needs credentials from the user. 8843 * 8844 * @param { Callback<OnHttpAuthRequestEvent, boolean> } callback The triggered when the browser needs credentials from the user. 8845 * @returns { WebAttribute } 8846 * @syscap SystemCapability.Web.Webview.Core 8847 * @crossplatform 8848 * @atomicservice 8849 * @since 12 8850 */ 8851 onHttpAuthRequest(callback: Callback<OnHttpAuthRequestEvent, boolean>): WebAttribute; 8852 8853 /** 8854 * Triggered when the resources loading is intercepted. 8855 * 8856 * @param { function } callback The triggered callback when the resources loading is intercepted. 8857 * @returns { WebAttribute } If the response value is null, the Web will continue to load the resources. Otherwise, the response value will be used 8858 * @syscap SystemCapability.Web.Webview.Core 8859 * @since 9 8860 */ 8861 /** 8862 * Triggered when the resources loading is intercepted. 8863 * 8864 * @param { function } callback The triggered callback when the resources loading is intercepted. 8865 * @returns { WebAttribute } If the response value is null, the Web will continue to load the resources. Otherwise, the response value will be used 8866 * @syscap SystemCapability.Web.Webview.Core 8867 * @atomicservice 8868 * @since 11 8869 */ 8870 /** 8871 * Triggered when the resources loading is intercepted. 8872 * 8873 * @param { Callback<OnInterceptRequestEvent, WebResourceResponse> } callback The triggered callback when the resources loading is intercepted. 8874 * @returns { WebAttribute } If the response value is null, the Web will continue to load the resources. Otherwise, the response value will be used 8875 * @syscap SystemCapability.Web.Webview.Core 8876 * @atomicservice 8877 * @since 12 8878 */ 8879 onInterceptRequest(callback: Callback<OnInterceptRequestEvent, WebResourceResponse>): WebAttribute; 8880 8881 /** 8882 * Triggered when the host application that web content from the specified origin is attempting to access the resources. 8883 * 8884 * @param { function } callback The triggered callback when the host application that web content from the specified origin is 8885 * attempting to access the resources. 8886 * @returns { WebAttribute } 8887 * @syscap SystemCapability.Web.Webview.Core 8888 * @since 9 8889 */ 8890 /** 8891 * Triggered when the host application that web content from the specified origin is attempting to access the resources. 8892 * 8893 * @param { function } callback The triggered callback when the host application that web content from the specified origin is 8894 * attempting to access the resources. 8895 * @returns { WebAttribute } 8896 * @syscap SystemCapability.Web.Webview.Core 8897 * @crossplatform 8898 * @atomicservice 8899 * @since 11 8900 */ 8901 /** 8902 * Called when a permission request is received. To call this API, you need to declare the ohos.permission.CAMERA and ohos.permission.MICROPHONE permissions. 8903 * 8904 * @param { Callback<OnPermissionRequestEvent> } callback Callback invoked when a permission request is received. 8905 * @returns { WebAttribute } 8906 * @syscap SystemCapability.Web.Webview.Core 8907 * @crossplatform 8908 * @atomicservice 8909 * @since arkts {'1.1':'12', '1.2':'20'} 8910 * @arkts 1.1&1.2 8911 */ 8912 onPermissionRequest(callback: Callback<OnPermissionRequestEvent>): WebAttribute; 8913 8914 /** 8915 * Triggered when the host application that web content from the specified origin is requesting to capture screen. 8916 * @param { function } callback The triggered callback when the host application that web content from the specified origin is 8917 * requesting to capture screen. 8918 * @returns { WebAttribute } 8919 * @syscap SystemCapability.Web.Webview.Core 8920 * @since 10 8921 */ 8922 /** 8923 * Triggered when the host application that web content from the specified origin is requesting to capture screen. 8924 * @param { function } callback The triggered callback when the host application that web content from the specified origin is 8925 * requesting to capture screen. 8926 * @returns { WebAttribute } 8927 * @syscap SystemCapability.Web.Webview.Core 8928 * @atomicservice 8929 * @since 11 8930 */ 8931 /** 8932 * Called when a screen capture request is received. 8933 * 8934 * @param { Callback<OnScreenCaptureRequestEvent> } callback Called when a screen capture request is received. 8935 * @returns { WebAttribute } 8936 * @syscap SystemCapability.Web.Webview.Core 8937 * @atomicservice 8938 * @since arkts {'1.1':'12', '1.2':'20'} 8939 * @arkts 1.1&1.2 8940 */ 8941 onScreenCaptureRequest(callback: Callback<OnScreenCaptureRequestEvent>): WebAttribute; 8942 8943 /** 8944 * Triggered when called to allow custom display of the context menu. 8945 * 8946 * @param { function } callback The triggered callback when called to allow custom display of the context menu. 8947 * @returns { WebAttribute } If custom display return true.Otherwise, default display return false. 8948 * @syscap SystemCapability.Web.Webview.Core 8949 * @since 9 8950 */ 8951 /** 8952 * Triggered when called to allow custom display of the context menu. 8953 * 8954 * @param { function } callback The triggered callback when called to allow custom display of the context menu. 8955 * @returns { WebAttribute } If custom display return true.Otherwise, default display return false. 8956 * @syscap SystemCapability.Web.Webview.Core 8957 * @atomicservice 8958 * @since 11 8959 */ 8960 /** 8961 * Triggered when called to allow custom display of the context menu. 8962 * 8963 * @param { Callback<OnContextMenuShowEvent, boolean> } callback The triggered callback when called to allow custom display of the context menu. 8964 * {@code true} means the custom menu is triggered. 8965 * {@code false} means the custom menu is invalid. 8966 * @returns { WebAttribute } If custom display return true.Otherwise, default display return false. 8967 * @syscap SystemCapability.Web.Webview.Core 8968 * @atomicservice 8969 * @since arkts {'1.1':'12', '1.2':'20'} 8970 * @arkts 1.1&1.2 8971 */ 8972 onContextMenuShow(callback: Callback<OnContextMenuShowEvent, boolean>): WebAttribute; 8973 8974 /** 8975 * Triggered when called to allow custom hide of the context menu. 8976 * 8977 * @param { OnContextMenuHideCallback } callback The triggered function when called to allow custom hide of the context menu. 8978 * @returns { WebAttribute } 8979 * @syscap SystemCapability.Web.Webview.Core 8980 * @atomicservice 8981 * @since 11 8982 */ 8983 onContextMenuHide(callback: OnContextMenuHideCallback): WebAttribute; 8984 8985 /** 8986 * Set whether media playback needs to be triggered by user gestures. 8987 * 8988 * @param { boolean } access True if it needs to be triggered manually by the user else false. 8989 * The default value is true. 8990 * @returns { WebAttribute } 8991 * @syscap SystemCapability.Web.Webview.Core 8992 * @since 9 8993 */ 8994 /** 8995 * Set whether to manually play audio-only videos. The playback of muted videos is not controlled by this interface. 8996 * 8997 * @param { boolean } access Set whether to manually play audio-only videos. 8998 * {@code true}True means setting up automatic playback of audio videos requires users to manually click, {@code false} otherwise. 8999 * Default value: true. 9000 * @returns { WebAttribute } 9001 * @syscap SystemCapability.Web.Webview.Core 9002 * @crossplatform 9003 * @atomicservice 9004 * @since arkts {'1.1':'11', '1.2':'20'} 9005 * @arkts 1.1&1.2 9006 */ 9007 mediaPlayGestureAccess(access: boolean): WebAttribute; 9008 9009 /** 9010 * Notify search result to host application through onSearchResultReceive. 9011 * 9012 * @param { function } callback Function Triggered when the host application call searchAllAsync. 9013 * or searchNext api on WebController and the request is valid. 9014 * @returns { WebAttribute } 9015 * @syscap SystemCapability.Web.Webview.Core 9016 * @since 9 9017 */ 9018 /** 9019 * Notify search result to host application through onSearchResultReceive. 9020 * 9021 * @param { function } callback Function Triggered when the host application call searchAllAsync. 9022 * or searchNext api on WebController and the request is valid. 9023 * @returns { WebAttribute } 9024 * @syscap SystemCapability.Web.Webview.Core 9025 * @atomicservice 9026 * @since 11 9027 */ 9028 /** 9029 * Notify search result to host application through onSearchResultReceive. 9030 * 9031 * @param { Callback<OnSearchResultReceiveEvent> } callback Function Triggered when the host application call searchAllAsync. 9032 * or searchNext api on WebController and the request is valid. 9033 * @returns { WebAttribute } 9034 * @syscap SystemCapability.Web.Webview.Core 9035 * @atomicservice 9036 * @since 12 9037 */ 9038 onSearchResultReceive(callback: Callback<OnSearchResultReceiveEvent>): WebAttribute; 9039 9040 /** 9041 * Notify the global scroll position of the web page 9042 * 9043 * Description: 9044 * 9045 * What is notified is the global scroll position of the page. 9046 * Changes in the local scroll position cannot trigger this callback. 9047 * 9048 * Determine whether the page is globally scrolled and print window.pagYOffset 9049 * or window.pagXOffset before and after scrolling. 9050 * 9051 * If it is global scrolling, the value of window.pagYOffset 9052 * or window.pagXOffset will change before and after scrolling, and vice versa. 9053 * 9054 * @param { function } callback Function triggered when the web page scroll to the specified position. 9055 * @returns { WebAttribute } 9056 * @syscap SystemCapability.Web.Webview.Core 9057 * @since 9 9058 */ 9059 /** 9060 * Notify the global scroll position of the web page 9061 * 9062 * Description: 9063 * 9064 * What is notified is the global scroll position of the page. 9065 * Changes in the local scroll position cannot trigger this callback. 9066 * 9067 * Determine whether the page is globally scrolled and print window.pagYOffset 9068 * or window.pagXOffset before and after scrolling. 9069 * 9070 * If it is global scrolling, the value of window.pagYOffset 9071 * or window.pagXOffset will change before and after scrolling, and vice versa. 9072 * 9073 * @param { function } callback Function triggered when the web page scroll to the specified position. 9074 * @returns { WebAttribute } 9075 * @syscap SystemCapability.Web.Webview.Core 9076 * @crossplatform 9077 * @atomicservice 9078 * @since 11 9079 */ 9080 /** 9081 * Notify the global scroll position of the web page 9082 * 9083 * Description: 9084 * 9085 * What is notified is the global scroll position of the page. 9086 * Changes in the local scroll position cannot trigger this callback. 9087 * 9088 * Determine whether the page is globally scrolled and print window.pagYOffset 9089 * or window.pagXOffset before and after scrolling. 9090 * 9091 * If it is global scrolling, the value of window.pagYOffset 9092 * or window.pagXOffset will change before and after scrolling, and vice versa. 9093 * 9094 * @param { Callback<OnScrollEvent> } callback Function triggered when the web page scroll to the specified position. 9095 * @returns { WebAttribute } 9096 * @syscap SystemCapability.Web.Webview.Core 9097 * @crossplatform 9098 * @atomicservice 9099 * @since 12 9100 */ 9101 onScroll(callback: Callback<OnScrollEvent>): WebAttribute; 9102 9103 /** 9104 * Called to notify users when an SSL error occurs with a request for the main frame. 9105 * To include errors with requests for subframes, use the OnSslErrorEvent API. 9106 * 9107 * @param { function } callback The triggered callback when the Web page receives an ssl Error. 9108 * @returns { WebAttribute } 9109 * @syscap SystemCapability.Web.Webview.Core 9110 * @since 9 9111 */ 9112 /** 9113 * Called to notify users when an SSL error occurs with a request for the main frame. 9114 * To include errors with requests for subframes, use the OnSslErrorEvent API. 9115 * 9116 * @param { function } callback The triggered callback when the Web page receives an ssl Error. 9117 * @returns { WebAttribute } 9118 * @syscap SystemCapability.Web.Webview.Core 9119 * @atomicservice 9120 * @since 11 9121 */ 9122 /** 9123 * Called to notify users when an SSL error occurs with a request for the main frame. 9124 * To include errors with requests for subframes, use the OnSslErrorEvent API. 9125 * 9126 * @param { Callback<OnSslErrorEventReceiveEvent> } callback The triggered callback when the Web page receives an ssl Error. 9127 * @returns { WebAttribute } 9128 * @syscap SystemCapability.Web.Webview.Core 9129 * @atomicservice 9130 * @since 12 9131 */ 9132 onSslErrorEventReceive(callback: Callback<OnSslErrorEventReceiveEvent>): WebAttribute; 9133 9134 /** 9135 * Called to notify users when an SSL error occurs during the loading of resources (for the main frame and subframes). 9136 * To handle SSL errors for requests for the main frame, use the isMainFrame field to distinguish. 9137 * 9138 * @param { OnSslErrorEventCallback } callback The triggered callback when the Web page receives an ssl Error. 9139 * @returns { WebAttribute } 9140 * @syscap SystemCapability.Web.Webview.Core 9141 * @atomicservice 9142 * @since 12 9143 */ 9144 onSslErrorEvent(callback: OnSslErrorEventCallback): WebAttribute; 9145 9146 /** 9147 * Triggered when the Web page needs ssl client certificate from the user. 9148 * 9149 * @param { function } callback The triggered callback when needs ssl client certificate from the user. 9150 * @returns { WebAttribute } 9151 * @syscap SystemCapability.Web.Webview.Core 9152 * @since 9 9153 */ 9154 /** 9155 * Triggered when the Web page needs ssl client certificate from the user. 9156 * 9157 * @param { function } callback The triggered callback when needs ssl client certificate from the user. 9158 * @returns { WebAttribute } 9159 * @syscap SystemCapability.Web.Webview.Core 9160 * @atomicservice 9161 * @since 11 9162 */ 9163 /** 9164 * Triggered when the Web page needs ssl client certificate from the user. 9165 * 9166 * @param { Callback<OnClientAuthenticationEvent> } callback The triggered callback when needs ssl client certificate from the user. 9167 * @returns { WebAttribute } 9168 * @syscap SystemCapability.Web.Webview.Core 9169 * @atomicservice 9170 * @since 12 9171 */ 9172 onClientAuthenticationRequest(callback: Callback<OnClientAuthenticationEvent>): WebAttribute; 9173 9174 /** 9175 * Triggered when web page requires the user to create a window. 9176 * 9177 * @param { function } callback The triggered callback when web page requires the user to create a window. 9178 * @returns { WebAttribute } 9179 * @syscap SystemCapability.Web.Webview.Core 9180 * @since 9 9181 */ 9182 /** 9183 * Triggered when web page requires the user to create a window. 9184 * 9185 * @param { function } callback The triggered callback when web page requires the user to create a window. 9186 * @returns { WebAttribute } 9187 * @syscap SystemCapability.Web.Webview.Core 9188 * @atomicservice 9189 * @since 11 9190 */ 9191 /** 9192 * Triggered when web page requires the user to create a window. 9193 * If the {@link setWebController} interface is not called, the render process will be blocked. 9194 * If no new window is created, it is set to null when calling the {@link setWebController} interface, 9195 * informing the Web that no new window is created. 9196 * The new window should avoid being directly overlaid on the original Web component, 9197 * and its URL (such as address bar) should be clearly displayed in the same form as the main page to 9198 * prevent users from being confused. If credible URL visualization management cannot be achieved, 9199 * it is necessary to consider prohibiting the creation of new windows. It should be noted that the source of 9200 * the new window request cannot be traced reliably, and it may be initiated by a third party iframe. 9201 * The application needs to take defensive measures such as sandbox isolation and permission restriction 9202 * by default to ensure security. 9203 * @param { Callback<OnWindowNewEvent> } callback The triggered callback when web page requires the user to create a window. 9204 * @returns { WebAttribute } 9205 * @syscap SystemCapability.Web.Webview.Core 9206 * @atomicservice 9207 * @since 12 9208 */ 9209 onWindowNew(callback: Callback<OnWindowNewEvent>): WebAttribute; 9210 9211 /** 9212 * Triggered when web page requires the user to close a window. 9213 * 9214 * @param { function } callback The triggered callback when web page requires the user to close a window. 9215 * @returns { WebAttribute } 9216 * @syscap SystemCapability.Web.Webview.Core 9217 * @since 9 9218 */ 9219 /** 9220 * Notifies the user of the window closing request. 9221 * Like {@link onWindowNew}, from a security perspective, applications should ensure that users can know that 9222 * the page they interact with is closed. 9223 * @param { function } callback The triggered callback when web page requires the user to close a window. 9224 * @returns { WebAttribute } 9225 * @syscap SystemCapability.Web.Webview.Core 9226 * @atomicservice 9227 * @since 11 9228 */ 9229 onWindowExit(callback: () => void): WebAttribute; 9230 9231 /** 9232 * Set whether multiple windows are supported. 9233 * 9234 * @param { boolean } multiWindow True if it needs to be triggered manually by the user else false. 9235 * The default value is false. 9236 * @returns { WebAttribute } 9237 * @syscap SystemCapability.Web.Webview.Core 9238 * @since 9 9239 */ 9240 /** 9241 * Set whether multiple windows are supported. 9242 * When multiple windows permissions are enabled, the {@link onWindowNew} event needs to be implemented. 9243 * @param { boolean } multiWindow True if it needs to be triggered manually by the user else false. 9244 * The default value is false. 9245 * @returns { WebAttribute } 9246 * @syscap SystemCapability.Web.Webview.Core 9247 * @atomicservice 9248 * @since 11 9249 */ 9250 multiWindowAccess(multiWindow: boolean): WebAttribute; 9251 9252 /** 9253 * Key events notify the application before the WebView consumes them. 9254 * 9255 * @param { function } callback Key event info. 9256 * @returns { WebAttribute } True if the application consumes key events else false. 9257 * @syscap SystemCapability.Web.Webview.Core 9258 * @since 9 9259 */ 9260 /** 9261 * Key events notify the application before the WebView consumes them. 9262 * 9263 * @param { function } callback Key event info. 9264 * @returns { WebAttribute } True if the application consumes key events else false. 9265 * @syscap SystemCapability.Web.Webview.Core 9266 * @atomicservice 9267 * @since 11 9268 */ 9269 onInterceptKeyEvent(callback: (event: KeyEvent) => boolean): WebAttribute; 9270 9271 /** 9272 * Set the font of webview standard font library. The default font is "sans serif". 9273 * 9274 * @param { string } family Standard font set series. 9275 * @returns { WebAttribute } 9276 * @syscap SystemCapability.Web.Webview.Core 9277 * @since 9 9278 */ 9279 /** 9280 * Sets the standard font family for the web page. 9281 * 9282 * @param { string } family Sets the standard font family for the web page. 9283 * Default value: sans-serif. 9284 * @returns { WebAttribute } 9285 * @syscap SystemCapability.Web.Webview.Core 9286 * @atomicservice 9287 * @since 11 9288 */ 9289 webStandardFont(family: string): WebAttribute; 9290 9291 /** 9292 * Set the font of webview serif font library. The default font is "serif". 9293 * 9294 * @param { string } family Serif font set series. 9295 * @returns { WebAttribute } 9296 * @syscap SystemCapability.Web.Webview.Core 9297 * @since 9 9298 */ 9299 /** 9300 * Sets the standard font family for the web page. 9301 * 9302 * @param { string } family Sets the standard font family for the web page. 9303 * Default value: sans-serif. 9304 * @returns { WebAttribute } 9305 * @syscap SystemCapability.Web.Webview.Core 9306 * @atomicservice 9307 * @since 11 9308 */ 9309 webSerifFont(family: string): WebAttribute; 9310 9311 /** 9312 * Set the font of webview sans serif font library. The default font is "sans-serif". 9313 * 9314 * @param { string } family Sans serif font set series. 9315 * @returns { WebAttribute } 9316 * @syscap SystemCapability.Web.Webview.Core 9317 * @since 9 9318 */ 9319 /** 9320 * Sets the sans serif font family for the web page. 9321 * 9322 * @param { string } family Sets the sans serif font family for the web page. 9323 * Default value: sans-serif. 9324 * @returns { WebAttribute } 9325 * @syscap SystemCapability.Web.Webview.Core 9326 * @atomicservice 9327 * @since 11 9328 */ 9329 webSansSerifFont(family: string): WebAttribute; 9330 9331 /** 9332 * Set the font of webview fixed font library. The default font is "monospace". 9333 * 9334 * @param { string } family Fixed font set series. 9335 * @returns { WebAttribute } 9336 * @syscap SystemCapability.Web.Webview.Core 9337 * @since 9 9338 */ 9339 /** 9340 * Sets the fixed font family for the web page. 9341 * 9342 * @param { string } family Sets the fixed font family for the web page. 9343 * Default value: monospace. 9344 * @returns { WebAttribute } 9345 * @syscap SystemCapability.Web.Webview.Core 9346 * @atomicservice 9347 * @since 11 9348 */ 9349 webFixedFont(family: string): WebAttribute; 9350 9351 /** 9352 * Set the font of webview fantasy font library. The default font is "fantasy". 9353 * 9354 * @param { string } family fantasy font set series. 9355 * @returns { WebAttribute } 9356 * @syscap SystemCapability.Web.Webview.Core 9357 * @since 9 9358 */ 9359 /** 9360 * Sets the fantasy font family for the web page. 9361 * 9362 * @param { string } family Sets the fantasy font family for the web page. 9363 * Default value: fantasy. 9364 * @returns { WebAttribute } 9365 * @syscap SystemCapability.Web.Webview.Core 9366 * @atomicservice 9367 * @since 11 9368 */ 9369 webFantasyFont(family: string): WebAttribute; 9370 9371 /** 9372 * Set the font of webview cursive font library. The default font is "cursive". 9373 * 9374 * @param { string } family Cursive font set series. 9375 * @returns { WebAttribute } 9376 * @syscap SystemCapability.Web.Webview.Core 9377 * @since 9 9378 */ 9379 /** 9380 * Sets the cursive font family for the web page. 9381 * 9382 * @param { string } family Sets the cursive font family for the web page. 9383 * Default value: cursive. 9384 * @returns { WebAttribute } 9385 * @syscap SystemCapability.Web.Webview.Core 9386 * @atomicservice 9387 * @since 11 9388 */ 9389 webCursiveFont(family: string): WebAttribute; 9390 9391 /** 9392 * Set the default fixed font value of webview. The default value is 13, ranging from 1 to 72. 9393 * 9394 * @param { number } size Font size. 9395 * @returns { WebAttribute } 9396 * @syscap SystemCapability.Web.Webview.Core 9397 * @since 9 9398 */ 9399 /** 9400 * Sets the default font size for the web page. 9401 * 9402 * @param { number } size Default fixed font size to set, in px. 9403 * The value ranges from -2^31 to 2^31-1. In actual rendering, 9404 * values greater than 72 are handled as 72, and values less than 1 are handled as 1. 9405 * Default value: 13. 9406 * @returns { WebAttribute } 9407 * @syscap SystemCapability.Web.Webview.Core 9408 * @atomicservice 9409 * @since 11 9410 */ 9411 defaultFixedFontSize(size: number): WebAttribute; 9412 9413 /** 9414 * Set the default font value of webview. The default value is 16, ranging from 1 to 72. 9415 * 9416 * @param { number } size Font size. 9417 * @returns { WebAttribute } 9418 * @syscap SystemCapability.Web.Webview.Core 9419 * @since 9 9420 */ 9421 /** 9422 * Sets the default font size for the web page. 9423 * 9424 * @param { number } size Default font size to set, in px. 9425 * The value ranges from -2^31 to 2^31-1. In actual rendering, values greater than 72 are handled as 72, 9426 * and values less than 1 are handled as 1. Default value: 16. 9427 * @returns { WebAttribute } 9428 * @syscap SystemCapability.Web.Webview.Core 9429 * @atomicservice 9430 * @since 11 9431 */ 9432 defaultFontSize(size: number): WebAttribute; 9433 9434 /** 9435 * Set the minimum value of webview font. The default value is 8, ranging from 1 to 72. 9436 * 9437 * @param { number } size Font size. 9438 * @returns { WebAttribute } 9439 * @syscap SystemCapability.Web.Webview.Core 9440 * @since 9 9441 */ 9442 /** 9443 * Sets the minimum font size for the web page. 9444 * 9445 * @param { number } size Minimum font size to set, in px. 9446 * The value ranges from -2^31 to 2^31-1. In actual rendering, 9447 * values greater than 72 are handled as 72, and values less than 1 are handled as 1. 9448 * Default value: 8 9449 * @returns { WebAttribute } 9450 * @syscap SystemCapability.Web.Webview.Core 9451 * @crossplatform 9452 * @atomicservice 9453 * @since 11 9454 */ 9455 minFontSize(size: number): WebAttribute; 9456 9457 /** 9458 * Set the logical minimum value of webview font. The default value is 8, ranging from 1 to 72. 9459 * 9460 * @param { number } size Font size. 9461 * @returns { WebAttribute } 9462 * @syscap SystemCapability.Web.Webview.Core 9463 * @since 9 9464 */ 9465 /** 9466 * Sets the minimum logical font size for the web page. 9467 * 9468 * @param { number } size Minimum logical font size to set, in px. 9469 * The value ranges from -2^31 to 2^31-1. In actual rendering, 9470 * values greater than 72 are handled as 72, and values less than 1 are handled as 1. 9471 * Default value: 8 9472 * @returns { WebAttribute } 9473 * @syscap SystemCapability.Web.Webview.Core 9474 * @atomicservice 9475 * @since 11 9476 */ 9477 minLogicalFontSize(size: number): WebAttribute; 9478 9479 /** 9480 * Set the default text encodingFormat value of webview. The default value is UTF-8. 9481 * 9482 * @param { string } textEncodingFormat text encodingFormat. 9483 * @returns { WebAttribute } 9484 * @syscap SystemCapability.Web.Webview.Core 9485 * @atomicservice 9486 * @since 12 9487 */ 9488 defaultTextEncodingFormat(textEncodingFormat: string): WebAttribute; 9489 9490 /** 9491 * Set whether the scroll bar is permanent. In the resident state, 9492 * when the page size exceeds one page, the scroll bar appears and does not disappear. 9493 * 9494 * Scroll bar resident is not supported in full expansion mode, 9495 * that is, when layoutMode is WebLayoutMode.FIT_CONTENT mode, the parameter enabled is false. 9496 * 9497 * @param { boolean } enabled {@code true} means show; {@code false} otherwise. default is false. 9498 * @returns { WebAttribute } 9499 * @syscap SystemCapability.Web.Webview.Core 9500 * @atomicservice 9501 * @since 14 9502 */ 9503 forceDisplayScrollBar(enabled: boolean): WebAttribute; 9504 9505 /** 9506 * Whether web component can load resource from network. 9507 * 9508 * @param { boolean } block {@code true} means it can't load resource from network; {@code false} otherwise. 9509 * @returns { WebAttribute } 9510 * @syscap SystemCapability.Web.Webview.Core 9511 * @since 9 9512 */ 9513 /** 9514 * Whether web component can load resource from network. 9515 * 9516 * @param { boolean } block {@code true} means it can't load resource from network; {@code false} otherwise. 9517 * @returns { WebAttribute } 9518 * @syscap SystemCapability.Web.Webview.Core 9519 * @atomicservice 9520 * @since 11 9521 */ 9522 /** 9523 * Whether web component can load resource from network. 9524 * 9525 * @param { boolean } block {@code true} means it can't load resource from network; {@code false} otherwise. 9526 * @returns { WebAttribute } 9527 * @syscap SystemCapability.Web.Webview.Core 9528 * @crossplatform 9529 * @atomicservice 9530 * @since 18 9531 */ 9532 blockNetwork(block: boolean): WebAttribute; 9533 9534 /** 9535 * Set whether paint horizontal scroll bar. 9536 * 9537 * @param { boolean } horizontalScrollBar True if it needs to paint horizontal scroll bar. 9538 * The default value is true. 9539 * @returns { WebAttribute } 9540 * @syscap SystemCapability.Web.Webview.Core 9541 * @since 9 9542 */ 9543 /** 9544 * Set whether paint horizontal scroll bar. 9545 * 9546 * <p><strong>API Note</strong>:<br> 9547 * After controlling the horizontal scrollbar's visibility through the @State variable, you need to call controller.refresh() to take effect.<br> 9548 * When frequently changing the @State variable dynamically, it is recommended to match the toggle variable with the Web component one-to-one. 9549 * </p> 9550 * 9551 * @param { boolean } horizontalScrollBar True if it needs to paint horizontal scroll bar. 9552 * The default value is true. 9553 * @returns { WebAttribute } 9554 * @syscap SystemCapability.Web.Webview.Core 9555 * @crossplatform 9556 * @atomicservice 9557 * @since 11 9558 */ 9559 horizontalScrollBarAccess(horizontalScrollBar: boolean): WebAttribute; 9560 9561 /** 9562 * Set whether paint vertical scroll bar. 9563 * 9564 * @param { boolean } verticalScrollBar True if it needs to paint vertical scroll bar. 9565 * The default value is true. 9566 * @returns { WebAttribute } 9567 * @syscap SystemCapability.Web.Webview.Core 9568 * @since 9 9569 */ 9570 /** 9571 * Set whether paint vertical scroll bar, including the system default scrollbar and user-defined scrollbar. 9572 * 9573 * <p><strong>API Note</strong>:<br> 9574 * After controlling the vertical scrollbar's visibility through the @State variable, you need to call controller.refresh() to take effect.<br> 9575 * When frequently changing the @State variable dynamically, it is recommended to match the toggle variable with the Web component one-to-one. 9576 * </p> 9577 * 9578 * @param { boolean } verticalScrollBar True if it needs to paint vertical scroll bar. 9579 * The default value is true. 9580 * @returns { WebAttribute } 9581 * @syscap SystemCapability.Web.Webview.Core 9582 * @crossplatform 9583 * @atomicservice 9584 * @since 11 9585 */ 9586 verticalScrollBarAccess(verticalScrollBar: boolean): WebAttribute; 9587 9588 /** 9589 * Triggered when the application receive the url of an apple-touch-icon. 9590 * 9591 * @param { function } callback The triggered callback when the application receive an new url of an 9592 * apple-touch-icon. 9593 * @returns { WebAttribute } 9594 * @syscap SystemCapability.Web.Webview.Core 9595 * @since 9 9596 */ 9597 /** 9598 * Triggered when the application receive the url of an apple-touch-icon. 9599 * 9600 * @param { function } callback The triggered callback when the application receive an new url of an 9601 * apple-touch-icon. 9602 * @returns { WebAttribute } 9603 * @syscap SystemCapability.Web.Webview.Core 9604 * @atomicservice 9605 * @since 11 9606 */ 9607 /** 9608 * Triggered when the application receive the url of an apple-touch-icon. 9609 * 9610 * @param { Callback<OnTouchIconUrlReceivedEvent> } callback The triggered callback when the application receive an new url of an 9611 * apple-touch-icon. 9612 * @returns { WebAttribute } 9613 * @syscap SystemCapability.Web.Webview.Core 9614 * @atomicservice 9615 * @since 12 9616 */ 9617 onTouchIconUrlReceived(callback: Callback<OnTouchIconUrlReceivedEvent>): WebAttribute; 9618 9619 /** 9620 * Triggered when the application receive a new favicon for the current web page. 9621 * 9622 * @param { function } callback The triggered callback when the application receive a new favicon for the 9623 * current web page. 9624 * @returns { WebAttribute } 9625 * @syscap SystemCapability.Web.Webview.Core 9626 * @since 9 9627 */ 9628 /** 9629 * Triggered when the application receive a new favicon for the current web page. 9630 * 9631 * @param { function } callback The triggered callback when the application receive a new favicon for the 9632 * current web page. 9633 * @returns { WebAttribute } 9634 * @syscap SystemCapability.Web.Webview.Core 9635 * @atomicservice 9636 * @since 11 9637 */ 9638 /** 9639 * Triggered when the application receive a new favicon for the current web page. 9640 * 9641 * @param { Callback<OnFaviconReceivedEvent> } callback The triggered callback when the application receive a new favicon for the 9642 * current web page. 9643 * @returns { WebAttribute } 9644 * @syscap SystemCapability.Web.Webview.Core 9645 * @atomicservice 9646 * @since 12 9647 */ 9648 onFaviconReceived(callback: Callback<OnFaviconReceivedEvent>): WebAttribute; 9649 9650 /** 9651 * Triggered when previous page will no longer be drawn and next page begin to draw. 9652 * 9653 * @param { function } callback The triggered callback when previous page will no longer be drawn and next 9654 * page begin to draw. 9655 * @returns { WebAttribute } 9656 * @syscap SystemCapability.Web.Webview.Core 9657 * @since 9 9658 */ 9659 /** 9660 * Triggered when previous page will no longer be drawn and next page begin to draw. 9661 * 9662 * @param { function } callback The triggered callback when previous page will no longer be drawn and next 9663 * page begin to draw. 9664 * @returns { WebAttribute } 9665 * @syscap SystemCapability.Web.Webview.Core 9666 * @crossplatform 9667 * @atomicservice 9668 * @since 11 9669 */ 9670 /** 9671 * Triggered when previous page will no longer be drawn and next page begin to draw. 9672 * 9673 * @param { Callback<OnPageVisibleEvent> } callback The triggered callback when previous page will no longer be drawn and next 9674 * page begin to draw. 9675 * @returns { WebAttribute } 9676 * @syscap SystemCapability.Web.Webview.Core 9677 * @crossplatform 9678 * @atomicservice 9679 * @since arkts {'1.1':'12', '1.2':'20'} 9680 * @arkts 1.1&1.2 9681 */ 9682 onPageVisible(callback: Callback<OnPageVisibleEvent>): WebAttribute; 9683 9684 /** 9685 * Triggered when the form could be resubmitted. 9686 * 9687 * @param { function } callback The triggered callback to decision whether resend form data or not. 9688 * @returns { WebAttribute } 9689 * @syscap SystemCapability.Web.Webview.Core 9690 * @since 9 9691 */ 9692 /** 9693 * Triggered when the form could be resubmitted. 9694 * 9695 * @param { function } callback The triggered callback to decision whether resend form data or not. 9696 * @returns { WebAttribute } 9697 * @syscap SystemCapability.Web.Webview.Core 9698 * @atomicservice 9699 * @since 11 9700 */ 9701 /** 9702 * Triggered when the form could be resubmitted. 9703 * 9704 * @param { Callback<OnDataResubmittedEvent> } callback The triggered callback to decision whether resend form data or not. 9705 * @returns { WebAttribute } 9706 * @syscap SystemCapability.Web.Webview.Core 9707 * @atomicservice 9708 * @since 12 9709 */ 9710 onDataResubmitted(callback: Callback<OnDataResubmittedEvent>): WebAttribute; 9711 9712 /** 9713 * Set whether enable pinch smooth mode. 9714 * 9715 * @param { boolean } isEnabled True if it needs to enable smooth mode. 9716 * @returns { WebAttribute } 9717 * @syscap SystemCapability.Web.Webview.Core 9718 * @since 9 9719 */ 9720 /** 9721 * Sets whether to enable smooth pinch mode for the web page. 9722 * 9723 * @param { boolean } isEnabled Whether to enable smooth pinch mode for the web page. 9724 * {@code true} means to enable smooth pinch mode for the web page; 9725 * {@code false} means not to enable smooth pinch mode for the web page. 9726 * The default value is false. 9727 * @returns { WebAttribute } 9728 * @syscap SystemCapability.Web.Webview.Core 9729 * @atomicservice 9730 * @since 11 9731 */ 9732 pinchSmooth(isEnabled: boolean): WebAttribute; 9733 9734 /** 9735 * Whether the window can be open automatically through JavaScript. 9736 * 9737 * @param { boolean } flag If it is true, the window can be opened automatically through JavaScript. 9738 * If it is false and user behavior, the window can be opened automatically through JavaScript. 9739 * Otherwise, the window cannot be opened. 9740 * @returns { WebAttribute } 9741 * @syscap SystemCapability.Web.Webview.Core 9742 * @since 10 9743 */ 9744 /** 9745 * Whether the window can be open automatically through JavaScript. 9746 * <p><strong>API Note</strong>:<br> 9747 * This API takes effect only when {@link JavaScript} is enabled. 9748 * This API opens a new window when {@link multiWindowAccess} is enabled and opens a local window 9749 * when {@link multiWindowAccess} is disabled. 9750 * The default value of **flag** is subject to the settings of the **persist.web.allowWindowOpenMethod.enabled** system attribute. 9751 * If this attribute is not set, the default value of **flag** is **false**. 9752 * To check the settings of **persist.web.allowWindowOpenMethod.enabled**, 9753 * run the **hdc shell param get persist.web.allowWindowOpenMethod.enabled** command. 9754 * If the attribute value is 1, it means the system attribute is enabled; 9755 * If the attribute value is 0 or does not exist, it means that the system attribute has not been enabled. 9756 * you can run the **hdc shell param set persist.web.allowWindowOpenMethod.enabled 1** command to enable it. 9757 * </p> 9758 * 9759 * @param { boolean } flag If it is true, the window can be opened automatically through JavaScript. 9760 * If it is false and user behavior, the window can be opened automatically through JavaScript. 9761 * Otherwise, the window cannot be opened. 9762 * The user behavior here refers to the behavior of requesting to open a new window (window. open) within 5 seconds after 9763 * the user clicks or performs other operations on the web component. 9764 * The default value is associated with system properties. 9765 * When the system property **persist.web.allowWindowOpenMethod.enabled** is set to true, the default value is true. 9766 * If the system property is not set, the default value is false. 9767 * @returns { WebAttribute } 9768 * @syscap SystemCapability.Web.Webview.Core 9769 * @atomicservice 9770 * @since 11 9771 */ 9772 allowWindowOpenMethod(flag: boolean): WebAttribute; 9773 9774 /** 9775 * Triggered when the playing state of audio on web page changed. 9776 * 9777 * @param { function } callback The playing state of audio on web page. 9778 * @returns { WebAttribute } 9779 * @syscap SystemCapability.Web.Webview.Core 9780 * @since 10 9781 */ 9782 /** 9783 * Triggered when the playing state of audio on web page changed. 9784 * 9785 * @param { function } callback The playing state of audio on web page. 9786 * @returns { WebAttribute } 9787 * @syscap SystemCapability.Web.Webview.Core 9788 * @atomicservice 9789 * @since 11 9790 */ 9791 /** 9792 * Set the callback function when the audio playback status on the webpage changes. 9793 * 9794 * @param { Callback<OnAudioStateChangedEvent> } callback Callback invoked when the audio playback status on the webpage changes. 9795 * @returns { WebAttribute } 9796 * @syscap SystemCapability.Web.Webview.Core 9797 * @atomicservice 9798 * @since 12 9799 */ 9800 onAudioStateChanged(callback: Callback<OnAudioStateChangedEvent>): WebAttribute; 9801 9802 /** 9803 * Triggered when the first content rendering of web page. 9804 * 9805 * @param { function } callback 9806 * @returns { WebAttribute } 9807 * @syscap SystemCapability.Web.Webview.Core 9808 * @since 10 9809 */ 9810 /** 9811 * Triggered when the first content rendering of web page. 9812 * 9813 * @param { function } callback 9814 * @returns { WebAttribute } 9815 * @syscap SystemCapability.Web.Webview.Core 9816 * @atomicservice 9817 * @since 11 9818 */ 9819 /** 9820 * Triggered when the first content rendering of web page. 9821 * 9822 * @param { Callback<OnFirstContentfulPaintEvent> } callback 9823 * @returns { WebAttribute } 9824 * @syscap SystemCapability.Web.Webview.Core 9825 * @atomicservice 9826 * @since 12 9827 */ 9828 onFirstContentfulPaint(callback: Callback<OnFirstContentfulPaintEvent>): WebAttribute; 9829 9830 /** 9831 * Called when the First rendering of meaningful content time(FMP) 9832 * 9833 * @param { OnFirstMeaningfulPaintCallback } callback Function Triggered when the firstMeaningfulPaint. 9834 * @returns { WebAttribute } 9835 * @syscap SystemCapability.Web.Webview.Core 9836 * @atomicservice 9837 * @since 12 9838 */ 9839 onFirstMeaningfulPaint(callback: OnFirstMeaningfulPaintCallback): WebAttribute; 9840 9841 /** 9842 * Called when the Maximum content rendering time(LCP). 9843 * 9844 * @param { OnLargestContentfulPaintCallback } callback Function Triggered when the largestContentfulPaint. 9845 * @returns { WebAttribute } 9846 * @syscap SystemCapability.Web.Webview.Core 9847 * @atomicservice 9848 * @since 12 9849 */ 9850 onLargestContentfulPaint(callback: OnLargestContentfulPaintCallback): WebAttribute; 9851 9852 /** 9853 * Triggered when the resources loading is intercepted. 9854 * 9855 * @param { function } callback The triggered callback when the resources loading is intercepted. 9856 * @returns { WebAttribute } 9857 * @syscap SystemCapability.Web.Webview.Core 9858 * @since 10 9859 */ 9860 /** 9861 * Triggered when the resources loading is intercepted. 9862 * 9863 * @param { function } callback The triggered callback when the resources loading is intercepted. 9864 * @returns { WebAttribute } 9865 * @syscap SystemCapability.Web.Webview.Core 9866 * @crossplatform 9867 * @atomicservice 9868 * @since 11 9869 */ 9870 /** 9871 * Triggered when the resources loading is intercepted. 9872 * 9873 * @param { Callback<OnLoadInterceptEvent, boolean> } callback The triggered callback when the resources loading is intercepted. 9874 * @returns { WebAttribute } 9875 * @syscap SystemCapability.Web.Webview.Core 9876 * @crossplatform 9877 * @atomicservice 9878 * @since arkts {'1.1':'12', '1.2':'20'} 9879 * @arkts 1.1&1.2 9880 */ 9881 onLoadIntercept(callback: Callback<OnLoadInterceptEvent, boolean>): WebAttribute; 9882 9883 /** 9884 * Triggered when The controller is bound to the web component, this controller must be a WebviewController. 9885 * This callback can not use the interface about manipulating web pages. 9886 * @param { function } callback The triggered callback when web controller initialization success. 9887 * @returns { WebAttribute } 9888 * @syscap SystemCapability.Web.Webview.Core 9889 * @since 10 9890 */ 9891 /** 9892 * The callback is triggered when the Controller is successfully bound to the Web component, 9893 * and the Controller must be a WebviewController, and it is forbidden to call the interface related to 9894 * the Web component before the event callback, otherwise a js-error exception will be thrown. 9895 * Because the webpage has not been loaded when the callback is called, it is impossible to use interfaces related to 9896 * operating webpages in the callback, such as {@link zoomIn} and {@link zoomOut}, and you can use interfaces unrelated to 9897 * operating webpages such as {@link loadUrl} and {@link getWebId}. 9898 * @param { function } callback The triggered callback when web controller initialization success. 9899 * @returns { WebAttribute } 9900 * @syscap SystemCapability.Web.Webview.Core 9901 * @crossplatform 9902 * @atomicservice 9903 * @since 11 9904 */ 9905 onControllerAttached(callback: () => void): WebAttribute; 9906 9907 /** 9908 * Triggered when the overscroll occurs. 9909 * @param { function } callback Function triggered when the overscroll occurs. 9910 * @returns { WebAttribute } 9911 * @syscap SystemCapability.Web.Webview.Core 9912 * @since 10 9913 */ 9914 /** 9915 * Triggered when the overscroll occurs. 9916 * @param { function } callback Function triggered when the overscroll occurs. 9917 * @returns { WebAttribute } 9918 * @syscap SystemCapability.Web.Webview.Core 9919 * @atomicservice 9920 * @since 11 9921 */ 9922 /** 9923 * Triggered when the overscroll occurs. 9924 * @param { Callback<OnOverScrollEvent> } callback Function triggered when the overscroll occurs. 9925 * @returns { WebAttribute } 9926 * @syscap SystemCapability.Web.Webview.Core 9927 * @atomicservice 9928 * @since 12 9929 */ 9930 onOverScroll(callback: Callback<OnOverScrollEvent>): WebAttribute; 9931 9932 /** 9933 * Triggered when the PDF in web page scrolling at bottom with pdf scroll event. 9934 * @param { Callback<OnPdfScrollEvent> } callback Function Triggered when the scrolling to bottom. 9935 * @returns { WebAttribute } 9936 * @syscap SystemCapability.Web.Webview.Core 9937 * @since 20 9938 */ 9939 onPdfScrollAtBottom(callback: Callback<OnPdfScrollEvent>): WebAttribute; 9940 9941 /** 9942 * Triggered when the PDF page load finish. 9943 * @param { Callback<OnPdfLoadEvent> } callback 9944 * @returns { WebAttribute } 9945 * @syscap SystemCapability.Web.Webview.Core 9946 * @since 20 9947 */ 9948 onPdfLoadEvent(callback: Callback<OnPdfLoadEvent>): WebAttribute; 9949 9950 /** 9951 * Called when received website security risk check result. 9952 * 9953 * @param { OnSafeBrowsingCheckResultCallback } callback - Function triggered when received website security risk check result. 9954 * @returns { WebAttribute } 9955 * @syscap SystemCapability.Web.Webview.Core 9956 * @atomicservice 9957 * @since 11 9958 */ 9959 onSafeBrowsingCheckResult(callback: OnSafeBrowsingCheckResultCallback): WebAttribute; 9960 9961 /** 9962 * Called when the load committed. 9963 * 9964 * @param { OnNavigationEntryCommittedCallback } callback Function Triggered when a load committed. 9965 * @returns { WebAttribute } 9966 * @syscap SystemCapability.Web.Webview.Core 9967 * @atomicservice 9968 * @since 11 9969 */ 9970 onNavigationEntryCommitted(callback: OnNavigationEntryCommittedCallback): WebAttribute; 9971 9972 /** 9973 * Called when tracker's cookie is prevented. 9974 * 9975 * @param { OnIntelligentTrackingPreventionCallback } callback - Callback triggered when tracker's cookie is prevented. 9976 * @returns { WebAttribute } 9977 * @syscap SystemCapability.Web.Webview.Core 9978 * @atomicservice 9979 * @since 12 9980 */ 9981 onIntelligentTrackingPreventionResult(callback: OnIntelligentTrackingPreventionCallback): WebAttribute; 9982 9983 /** 9984 * Injects the JavaScripts script into the Web component. 9985 * When the specified page or document starts to be loaded, the script is executed on any page whose source matches scriptRules. 9986 * <p><strong>API Note</strong>:<br> 9987 * The script runs before any JavaScript code of the page, when the DOM tree may not have been loaded or rendered. 9988 * The script is executed in the lexicographic order, not array order. 9989 * If the array order is required, you are advised to use the runJavaScriptOnDocumentStart interface. 9990 * You are not advised to use this API together with runJavaScriptOnDocumentStart. 9991 * When scripts with identical content are injected multiple times, 9992 * silent deduplication will be performed: repeated scripts will neither be displayed nor prompted, 9993 * and the scriptRules used during the first injection will be adopted. 9994 * </p> 9995 * 9996 * @param { Array<ScriptItem> } scripts - The array of the JavaScripts to be injected. 9997 * @returns { WebAttribute } 9998 * @syscap SystemCapability.Web.Webview.Core 9999 * @atomicservice 10000 * @since 11 10001 */ 10002 javaScriptOnDocumentStart(scripts: Array<ScriptItem>): WebAttribute; 10003 10004 /** 10005 * Injects the JavaScripts script into the Web component. 10006 * When the specified page or document has been loaded, the script is executed on any page whose source matches scriptRules. 10007 * <p><strong>API NOTE</strong>:<br> 10008 * The script runs after any JavaScript code of the page, when the DOM tree has been loaded and rendered. 10009 * The script is excuted in the lexicographic order, not array order. 10010 * If the array order is required, you are advised to use the runJavaScriptOnDocumentEnd interface. 10011 * You are not advised to use this API together with runJavaScriptOnDocumentEnd. 10012 * When scripts with identical content are injected multiple times, 10013 * silent deduplication will be performed: repeated scripts will neither be displayed nor prompted, 10014 * and the scriptRules used during the first injection will be adopted. 10015 * <p> 10016 * 10017 * @param { Array<ScriptItem> } scripts - The array of the JavaScripts to be injected. 10018 * @returns { WebAttribute } 10019 * @syscap SystemCapability.Web.Webview.Core 10020 * @atomicservice 10021 * @since 11 10022 */ 10023 javaScriptOnDocumentEnd(scripts: Array<ScriptItem>): WebAttribute; 10024 10025 /** 10026 * Sets the web layout mode. 10027 * 10028 * <p><strong>API Note</strong>:<br> 10029 * Currently, only two web layout modes are supported: WebLayoutMode.NONE and WebLayoutMode.FIT_CONTENT. 10030 * The following restrictions apply with the usage of WebLayoutMode.FIT_CONTENT: 10031 * - If the Web component is wider or longer than 7680 px, specify the RenderMode.SYNC_RENDER mode 10032 * when creating the Web component; otherwise, the screen may be blank. 10033 * - After the Web component is created, dynamic switching of the layoutMode is not supported. 10034 * - The width and height of a Web component cannot exceed 500,000 px when the RenderMode.SYNC_RENDER mode is specified, 10035 * and cannot exceed 7680 px when the RenderMode.ASYNC_RENDER mode is specified. 10036 * - Frequent changes to the page width and height will trigger a re-layout of the Web component, 10037 * which can affect the user experience. 10038 * - Waterfall web pages are not supported (drop down to the bottom to load more). 10039 * - Only height adaptation is supported(VH units are not supported). Width adaptation is not supported. 10040 * - Because the height is adaptive to the web page height, 10041 * the component height cannot be changed by modifying the component height attribute. 10042 * </p> 10043 * 10044 * @param { WebLayoutMode } mode - The web layout mode, follow the system or adaptive layout. 10045 * The default value is WebLayoutMode.NONE. 10046 * @returns { WebAttribute } 10047 * @syscap SystemCapability.Web.Webview.Core 10048 * @atomicservice 10049 * @since 11 10050 */ 10051 layoutMode(mode: WebLayoutMode): WebAttribute; 10052 10053 /** 10054 * Called to setting the nested scroll options. 10055 * 10056 * @param { NestedScrollOptions } value - options for nested scrolling. 10057 * @returns { WebAttribute } the attribute of the scroll. 10058 * @syscap SystemCapability.Web.Webview.Core 10059 * @atomicservice 10060 * @since 11 10061 */ 10062 /** 10063 * Called to setting the nested scroll options. 10064 * 10065 * <p><strong>API Note</strong>:<br> 10066 * You can set four directions: up, down, left, and right, or set nested scrolling modes for forward and backward directions 10067 * to achieve scrolling linkage with the parent component.<br> 10068 * When value is of type NestedScrollOptionsExt (four directions: up, down, left, and right), the default scrolling options 10069 * for scrollUp, scrollDown, scrollLeft, and scrollRight are NestedScrollMode.SELF_FIRST.<br> 10070 * When value is of type NestedScrollOptions (two directions: forward and backward), the default scrolling options for scrollForward 10071 * and scrollBackward are NestedScrollMode.SELF_FIRST.<br> 10072 * Supported nested scrolling containers: Grid, List, Scroll, Swiper, Tabs, WaterFlow, Refresh, bindSheet.<br> 10073 * Supported nested scrolling input events: gestures, mouse, and trackpad.<br> 10074 * In nested scrolling scenarios, since web scrolling to the edge will prioritize triggering the overscroll bounce effect, 10075 * it is recommended to set overScrollMode to OverScrollMode.NEVER to avoid affecting the user experience in this scenario. 10076 * </p> 10077 * 10078 * @param { NestedScrollOptions | NestedScrollOptionsExt } value - options for 10079 * nested scrolling. 10080 * @returns { WebAttribute } the attribute of the scroll. 10081 * @syscap SystemCapability.Web.Webview.Core 10082 * @atomicservice 10083 * @since 14 10084 */ 10085 nestedScroll(value: NestedScrollOptions | NestedScrollOptionsExt): WebAttribute; 10086 10087 /** 10088 * Sets the enable native embed mode for web. 10089 * 10090 * <p><strong>API Note</strong>: 10091 * <strong>Performance Note</strong>: 10092 * <p>For details about how to rendering native components on the Web using same-layer rendering, 10093 * see [Rendering Native Components on the Web Using Same-Layer Rendering]{@link https://developer.huawei.com/consumer/en/doc/best-practices/bpta-render-web-using-same-layer-render} 10094 * </p> 10095 * 10096 * @param { boolean } mode - True if it needs to enable native embed mode. 10097 * @returns { WebAttribute } 10098 * @syscap SystemCapability.Web.Webview.Core 10099 * @atomicservice 10100 * @since 11 10101 */ 10102 enableNativeEmbedMode(mode: boolean): WebAttribute; 10103 10104 /** 10105 * Registers the HTML tag name and type for same-layer rendering. 10106 * The tag name only supports object and embed. 10107 * The tag type only supports visible ASCII characters.<br> 10108 * If the specified type is the same as the W3C standard object or embed type, 10109 * the ArkWeb kernel identifies the type as a non-same-layer tag.<br> 10110 * This API is also controlled by the enableNativeEmbedMode API and 10111 * does not take effect if same-layer rendering is not enabled. When this API is not used, 10112 * the ArkWeb engine recognizes the embed tags with the "native/" prefix as same-layer tags. 10113 * 10114 * @param { string } tag - Tag name. 10115 * @param { string } type - Type of the tag, The kernel matches this parameter with a prefix. 10116 * @returns { WebAttribute } 10117 * @syscap SystemCapability.Web.Webview.Core 10118 * @atomicservice 10119 * @since 12 10120 */ 10121 registerNativeEmbedRule(tag: string, type:string): WebAttribute; 10122 10123 /** 10124 * Triggered when embed lifecycle changes. 10125 * 10126 * <p><strong>API Note</strong>: 10127 * <strong>Performance Note</strong>: 10128 * <p>For details about how to rendering native components on the Web using same-layer rendering, 10129 * see [Rendering Native Components on the Web Using Same-Layer Rendering]{@link https://developer.huawei.com/consumer/en/doc/best-practices/bpta-render-web-using-same-layer-render} 10130 * </p> 10131 * 10132 * @param { function } callback - Function Triggered when embed lifecycle changes. 10133 * @returns { WebAttribute } 10134 * @syscap SystemCapability.Web.Webview.Core 10135 * @atomicservice 10136 * @since 11 10137 */ 10138 onNativeEmbedLifecycleChange(callback: (event: NativeEmbedDataInfo) => void): WebAttribute; 10139 10140 /** 10141 * Called when the visibility of a same-layer tag (such as an Embed tag or an Object tag) on a web page changes in the viewport. 10142 * By default, the same-layer tag is invisible. If the rendering tag is visible when you access the page for the first time, 10143 * the callback is triggered; otherwise, it is not triggered. That is, if the same-layer tag changes from a non-zero value to 0 x 0, 10144 * the callback is triggered. If the rendering tag size changes from 0 x 0 to a non-zero value, the callback is not triggered. 10145 * If all the same-layer tags are invisible, they are reported as invisible. If all the same-layer rendering tags or part of them are visible, 10146 * they are reported as invisible. 10147 * 10148 * @param { OnNativeEmbedVisibilityChangeCallback } callback - Callback triggered when embed visibility changes. 10149 * @returns { WebAttribute } 10150 * @syscap SystemCapability.Web.Webview.Core 10151 * @since 12 10152 */ 10153 onNativeEmbedVisibilityChange(callback: OnNativeEmbedVisibilityChangeCallback): WebAttribute; 10154 10155 /** 10156 * Triggered when gesture effect on embed tag. 10157 * 10158 * <p><strong>API Note</strong>: 10159 * <strong>Performance Note</strong>: 10160 * <p>For details about how to rendering native components on the Web using same-layer rendering, 10161 * see [Rendering Native Components on the Web Using Same-Layer Rendering]{@link https://developer.huawei.com/consumer/en/doc/best-practices/bpta-render-web-using-same-layer-render} 10162 * </p> 10163 * 10164 * @param { function } callback - Function Triggered when gesture effect on embed tag. 10165 * @returns { WebAttribute } 10166 * @syscap SystemCapability.Web.Webview.Core 10167 * @atomicservice 10168 * @since 11 10169 */ 10170 onNativeEmbedGestureEvent(callback: (event: NativeEmbedTouchInfo) => void): WebAttribute; 10171 10172 /** 10173 * Triggered when mouse effect on embed tag. 10174 * 10175 * @param { MouseInfoCallback } callback - callback Triggered when mouse effect on embed tag. 10176 * @returns { WebAttribute } 10177 * @syscap SystemCapability.Web.Webview.Core 10178 * @since 20 10179 */ 10180 onNativeEmbedMouseEvent(callback: MouseInfoCallback): WebAttribute; 10181 10182 /** 10183 * Called to set copy option 10184 * 10185 * @param { CopyOptions } value - copy option.The default value is CopyOptions.LocalDevice. 10186 * @returns { WebAttribute } the attribute of the scroll. 10187 * @syscap SystemCapability.Web.Webview.Core 10188 * @atomicservice 10189 * @since 11 10190 */ 10191 copyOptions(value: CopyOptions): WebAttribute; 10192 10193 /** 10194 * When the URL is about to be loaded into the current Web, it gives the application the opportunity to take control. 10195 * This will not called for POST requests, may be called for subframes and with non-HTTP(S) schemes. 10196 * 10197 * @param { OnOverrideUrlLoadingCallback } callback - The callback for onOverrideUrlLoading. 10198 * @returns { WebAttribute } 10199 * @syscap SystemCapability.Web.Webview.Core 10200 * @atomicservice 10201 * @since 12 10202 */ 10203 onOverrideUrlLoading(callback: OnOverrideUrlLoadingCallback): WebAttribute; 10204 10205 /** 10206 * Sets whether automatic text resizing is enabled. 10207 * 10208 * @param { boolean } textAutosizing - Whether automatic text resizing is enabled. 10209 * {@code true} means enable text autosizing; 10210 * {@code false} means disable text autosizing. 10211 * Default value: true. 10212 * @returns { WebAttribute } 10213 * @syscap SystemCapability.Web.Webview.Core 10214 * @atomicservice 10215 * @since 12 10216 */ 10217 textAutosizing(textAutosizing: boolean): WebAttribute; 10218 10219 /** 10220 * Enable the application takeover of web media playback feature. 10221 * 10222 * @param { NativeMediaPlayerConfig } config - The configuration of native media player. 10223 * enable: whether to enable the feature, shouldOverlay: whether the image of the video player 10224 * taken over by the application will overlay the web page content, if this feature is enabled. 10225 * Default value: {enable: false, shouldOverlay: false}. 10226 * @returns { WebAttribute } 10227 * @syscap SystemCapability.Web.Webview.Core 10228 * @atomicservice 10229 * @since 12 10230 */ 10231 enableNativeMediaPlayer(config: NativeMediaPlayerConfig): WebAttribute; 10232 10233 /** 10234 * Triggered when render process not responding. 10235 * If the Web component can't handle the input event, or can't navigate to the new URL within a reasonable time range, 10236 * the Web page process is considered unresponsive and the callback will be triggered. 10237 * As long as the web process has been unresponsive, this callback may continue to trigger until 10238 * the web process responds again, at which time {@link onRenderProcessResponding} will trigger. 10239 * Applications can terminate the associated rendering process through the WebviewController interface {@link terminateRenderProcess}, 10240 * which may affect other Web components in the same rendering process. 10241 * @param { OnRenderProcessNotRespondingCallback } callback The triggered function when render process not responding. 10242 * @returns { WebAttribute } 10243 * @syscap SystemCapability.Web.Webview.Core 10244 * @since 12 10245 */ 10246 onRenderProcessNotResponding(callback: OnRenderProcessNotRespondingCallback): WebAttribute; 10247 10248 /** 10249 * This callback function is triggered when the rendering process changes from unresponsive state to normal operation state, 10250 * which indicates that the webpage is not really stuck. 10251 * 10252 * @param { OnRenderProcessRespondingCallback } callback The triggered function when the unresponsive render process becomes responsive. 10253 * @returns { WebAttribute } 10254 * @syscap SystemCapability.Web.Webview.Core 10255 * @since 12 10256 */ 10257 onRenderProcessResponding(callback: OnRenderProcessRespondingCallback): WebAttribute; 10258 10259 /** 10260 * Set the custom text menu. 10261 * The Web component custom menu extension item interface allows users to set the extension item's text content, icon, and callback method. 10262 * 10263 * <p><strong>API Note</strong>:<br> 10264 * This interface only supports selecting plain text. When the selected content contains images and other non-text content, 10265 * garbled characters will be displayed in the action information. 10266 * </p> 10267 * 10268 * @param { Array<ExpandedMenuItemOptions> } expandedMenuOptions - Customize text menu options. 10269 * The number of menu items, the content size of the menu, and the startIcon 10270 * icon size are consistent with the ArkUI Menu component. 10271 * @returns { WebAttribute } 10272 * @syscap SystemCapability.Web.Webview.Core 10273 * @since 12 10274 * @deprecated since 20 10275 * @useinstead ohos.web.WebAttribute#editMenuOptions 10276 */ 10277 selectionMenuOptions(expandedMenuOptions: Array<ExpandedMenuItemOptions>): WebAttribute; 10278 10279 /** 10280 * Called when the viewport-fit configuration in the web page's <meta> tag changes. 10281 * The application can adapt its layout to the viewport within this callback. 10282 * 10283 * @param { OnViewportFitChangedCallback } callback - Callback invoked when the viewport-fit configuration in the web page's <meta> tag changes. 10284 * @returns { WebAttribute } 10285 * @syscap SystemCapability.Web.Webview.Core 10286 * @atomicservice 10287 * @since 12 10288 */ 10289 onViewportFitChanged(callback: OnViewportFitChangedCallback): WebAttribute; 10290 10291 /** 10292 * Editable elements (such as input labels) in web pages will call back to this interface before pulling up 10293 * the soft keyboard. Applications can use this interface to intercept the pop-up of the system soft keyboard 10294 * and configure the application-customized soft keyboard (according to this interface, 10295 * the application can decide to use the system default soft keyboard/the system soft keyboard with 10296 * the enter key customized/all the soft keyboards customized by the application). 10297 * 10298 * @param { WebKeyboardCallback } callback - The callback for onInterceptKeyboardAttach. 10299 * @returns { WebAttribute } 10300 * @syscap SystemCapability.Web.Webview.Core 10301 * @atomicservice 10302 * @since arkts {'1.1':'12', '1.2':'20'} 10303 * @arkts 1.1&1.2 10304 */ 10305 onInterceptKeyboardAttach(callback: WebKeyboardCallback): WebAttribute; 10306 10307 /** 10308 * Called when received Ads blocked results. 10309 * If blocked results exist at the end of page loading, the first call will be triggered. 10310 * To avoid performance issues, subsequent results will be periodically reported through this api. 10311 * 10312 * @param { OnAdsBlockedCallback } callback - The callback for OnAdsBlockedCallback. 10313 * @returns { WebAttribute } 10314 * @syscap SystemCapability.Web.Webview.Core 10315 * @atomicservice 10316 * @since 12 10317 */ 10318 onAdsBlocked(callback: OnAdsBlockedCallback): WebAttribute; 10319 10320 /** 10321 * When the keyboard avoidance mode set by UIContext is {@link KeyboardAvoidMode.RESIZE} mode, 10322 * the interface function will not take effect. 10323 * @param { WebKeyboardAvoidMode } mode - The web keyboard avoid mode, which can be {@link WebKeyboardAvoidMode}. 10324 * Web soft keyboard avoidance is not recommended in nested scrolling scenes, 10325 * including RESIZE_VISUAL and RESIZE_CONTENT. 10326 * @returns { WebAttribute } 10327 * @syscap SystemCapability.Web.Webview.Core 10328 * @atomicservice 10329 * @since 12 10330 */ 10331 keyboardAvoidMode(mode: WebKeyboardAvoidMode): WebAttribute; 10332 10333 /** 10334 * Set the custom text menu. 10335 * 10336 * <p><strong>API Note</strong>:<br> 10337 * The onCreateMenu interface is used to modify, add, and delete menu options.If you want to hide the text menu, 10338 * you need to return an empty array.<br> 10339 * The onMenuItemClick interface allows you to define the callback function for menu options.This function is 10340 * triggered when a menu option is clicked, and it determines whether to execute the system's default callback 10341 * based on the return value. Returning true prevents the system callback from executing, while returning false 10342 * continues with the system callback.<br> 10343 * The editMenuOptions interface makes the selectionMenuOptions (deprecated) not work when used at the same time. 10344 * </p> 10345 * 10346 * @param { EditMenuOptions } editMenu - Customize text menu options. 10347 * The number of menu items, as well as the content size and icon size of the menu, 10348 * should be consistent with the ArkUI Menu component. 10349 * The system-provided id enumeration values (TextMenuItemId) in the menu are only 10350 * supportedfor CUT, COPY, PASTE, and SELECT_ALL in the web. 10351 * The textRange parameter in the onMenuItemClick function is meaningless in the web, 10352 * and the input value is -1. 10353 * @returns { WebAttribute } 10354 * @syscap SystemCapability.Web.Webview.Core 10355 * @since 12 10356 */ 10357 editMenuOptions(editMenu: EditMenuOptions): WebAttribute; 10358 10359 /** 10360 * Enable or disable haptic feedback. 10361 * 10362 * @param { boolean } enabled - Default value is true, set false to disable haptic feedback. 10363 * @returns { WebAttribute } 10364 * @syscap SystemCapability.Web.Webview.Core 10365 * @since 13 10366 */ 10367 enableHapticFeedback(enabled: boolean): WebAttribute; 10368 10369 /** 10370 * Bind to the selection menu. 10371 * 10372 * @param { WebElementType } elementType - Indicates the type of selection menu. 10373 * @param { CustomBuilder } content - Indicates the content of selection menu. 10374 * @param { WebResponseType } responseType - Indicates response type of selection menu. 10375 * @param { SelectionMenuOptionsExt } [options] - Indicates the options of selection menu. 10376 * @returns { WebAttribute } 10377 * @syscap SystemCapability.Web.Webview.Core 10378 * @since 13 10379 */ 10380 bindSelectionMenu(elementType: WebElementType, content: CustomBuilder, responseType: WebResponseType, 10381 options?: SelectionMenuOptionsExt): WebAttribute; 10382 10383 /** 10384 * Sets whether to optimize parser budget to reduce FCP time 10385 * 10386 * @param { boolean} optimizeParserBudget Default value is false, set true to enable optimize parser budget. 10387 * @returns { WebAttribute } 10388 * @syscap SystemCapability.Web.Webview.Core 10389 * @since 15 10390 */ 10391 optimizeParserBudget(optimizeParserBudget: boolean): WebAttribute; 10392 10393 /** 10394 * Sets whether to follow the system font weight. 10395 * 10396 * @param { boolean } follow The value true means to follow the system font weight, and false means the opposite. 10397 * @returns { WebAttribute } 10398 * @syscap SystemCapability.Web.Webview.Core 10399 * @since 18 10400 */ 10401 enableFollowSystemFontWeight(follow: boolean): WebAttribute; 10402 10403 /** 10404 * Sets whether to enable AVSession for web pages. 10405 * 10406 * @param { boolean } enabled Whether to enable AVSession. The value true means to enable AVSession, and false means the opposite. 10407 * @returns { WebAttribute } 10408 * @syscap SystemCapability.Web.Webview.Core 10409 * @since 18 10410 */ 10411 enableWebAVSession(enabled: boolean): WebAttribute; 10412 10413 /** 10414 * Injects the JavaScripts that will be run just after document object has been created. 10415 * 10416 * @param { Array<ScriptItem> } scripts - The JavaScripts executed in array order. 10417 * @returns { WebAttribute } 10418 * @syscap SystemCapability.Web.Webview.Core 10419 * @since 15 10420 */ 10421 runJavaScriptOnDocumentStart(scripts: Array<ScriptItem>): WebAttribute; 10422 10423 /** 10424 * Injects the JavaScripts that will be run after document has been parsed finished. 10425 * 10426 * @param { Array<ScriptItem> } scripts - The JavaScripts executed in array order. 10427 * @returns { WebAttribute } 10428 * @syscap SystemCapability.Web.Webview.Core 10429 * @since 15 10430 */ 10431 runJavaScriptOnDocumentEnd(scripts: Array<ScriptItem>): WebAttribute; 10432 10433 /** 10434 * Injects the JavaScripts that will be run after head element has been parsed finished. 10435 * 10436 * @param { Array<ScriptItem> } scripts - The JavaScripts executed in array order. 10437 * @returns { WebAttribute } 10438 * @syscap SystemCapability.Web.Webview.Core 10439 * @since 15 10440 */ 10441 runJavaScriptOnHeadEnd(scripts: Array<ScriptItem>): WebAttribute; 10442 10443 /** 10444 * Sets the embed options, only valid when enableNativeEmbedMode is true. 10445 * 10446 * @param { EmbedOptions } options The embed options, which can be {@link EmbedOptions}. 10447 * @returns { WebAttribute } 10448 * @syscap SystemCapability.Web.Webview.Core 10449 * @since 16 10450 */ 10451 nativeEmbedOptions(options?: EmbedOptions): WebAttribute; 10452 10453 /** 10454 * Enable data detector. 10455 * 10456 * @param { boolean } enable - {@code true} means enable data detector in Web;{@code false} otherwise. 10457 * The default value is false. 10458 * @returns { WebAttribute } The attribute of the web. 10459 * @syscap SystemCapability.Web.Webview.Core 10460 * @since 20 10461 */ 10462 enableDataDetector(enable: boolean): WebAttribute; 10463 10464 /** 10465 * Data detector with config. 10466 * 10467 * @param { TextDataDetectorConfig } config - The config of text data detector. 10468 * @returns { WebAttribute } The attribute of the web. 10469 * @syscap SystemCapability.Web.Webview.Core 10470 * @since 20 10471 */ 10472 dataDetectorConfig(config: TextDataDetectorConfig): WebAttribute; 10473 10474 /** 10475 * Triggered when the web page is activated for window.open called by other web component. 10476 * 10477 * @param { Callback<void> } callback the triggered function when the web page is activated for window.open called by other web component. 10478 * @returns { WebAttribute } 10479 * @syscap SystemCapability.Web.Webview.Core 10480 * @since 20 10481 */ 10482 onActivateContent(callback: Callback<void>): WebAttribute; 10483 10484 /** 10485 * Set up a condition that bypass vsync 10486 * If the condition is matched, the drawing schedule does not reply on Vsync scheduling 10487 * and directly rendering and drawing 10488 * 10489 * @param { WebBypassVsyncCondition } condition - The condition to bypass render vsync. 10490 * @returns { WebAttribute } 10491 * @syscap SystemCapability.Web.Webview.Core 10492 * @since 20 10493 */ 10494 bypassVsyncCondition(condition: WebBypassVsyncCondition): WebAttribute; 10495 10496 /** 10497 * Set the gesture focus acquisition mode. 10498 * When users interact with the web using different gestures, 10499 * this determines whether and when focus is acquired based on the configured mode. 10500 * Default value: DEFAULT, where all gestures acquire focus on touch down. 10501 * 10502 * @param { GestureFocusMode } mode - The gesture focus mode, which can be {@link GestureFocusMode}. 10503 * The default value is FocusMode.DEFAULT. 10504 * @returns { WebAttribute } 10505 * @syscap SystemCapability.Web.Webview.Core 10506 * @since 20 10507 */ 10508 gestureFocusMode(mode: GestureFocusMode): WebAttribute; 10509} 10510 10511/** 10512 * Defines Web Component. 10513 * 10514 * @syscap SystemCapability.Web.Webview.Core 10515 * @atomicservice 10516 * @since 8 10517 */ 10518/** 10519 * Defines Web Component. 10520 * 10521 * @syscap SystemCapability.Web.Webview.Core 10522 * @crossplatform 10523 * @since 10 10524 */ 10525/** 10526 * Defines Web Component. 10527 * 10528 * <p><strong>API Note</strong>: 10529 * 10530 * <strong>Performance Note</strong>: 10531 * <p>For details about how to optimize the compilation, resource loading, and JSBridge performance, 10532 * see [Optimizing Web Page Loading]{@link https://developer.huawei.com/consumer/en/doc/best-practices/bpta-web-develop-optimization} 10533 * <p>When the white screen duration is long due to complex web page parsing, 10534 * you can enable [optimizeParserBudget]{@link WebAttribute.optimizeParserBudget} to reduce the first frame rendering content.</p> 10535 * </p> 10536 * 10537 * @syscap SystemCapability.Web.Webview.Core 10538 * @crossplatform 10539 * @atomicservice 10540 * @since 11 10541 */ 10542declare const Web: WebInterface; 10543 10544/** 10545 * Defines Web Component instance. 10546 * 10547 * @syscap SystemCapability.Web.Webview.Core 10548 * @since 8 10549 */ 10550/** 10551 * Defines Web Component instance. 10552 * 10553 * @syscap SystemCapability.Web.Webview.Core 10554 * @atomicservice 10555 * @since 11 10556 */ 10557declare const WebInstance: WebAttribute; 10558 10559/** 10560 * Defines the ssl error event. 10561 * 10562 * @typedef SslErrorEvent 10563 * @syscap SystemCapability.Web.Webview.Core 10564 * @atomicservice 10565 * @since 12 10566 */ 10567declare interface SslErrorEvent { 10568 /** 10569 * Notifies the user of the operation behavior of the web component. 10570 * 10571 * @type { SslErrorHandler } 10572 * @syscap SystemCapability.Web.Webview.Core 10573 * @atomicservice 10574 * @since 12 10575 */ 10576 handler: SslErrorHandler; 10577 10578 /** 10579 * Error codes. 10580 * 10581 * @type { SslError } 10582 * @syscap SystemCapability.Web.Webview.Core 10583 * @atomicservice 10584 * @since 12 10585 */ 10586 error: SslError; 10587 10588 /** 10589 * Request url. 10590 * 10591 * @type { string } 10592 * @syscap SystemCapability.Web.Webview.Core 10593 * @atomicservice 10594 * @since 12 10595 */ 10596 url: string; 10597 10598 /** 10599 * Original url. 10600 * 10601 * @type { string } 10602 * @syscap SystemCapability.Web.Webview.Core 10603 * @atomicservice 10604 * @since 12 10605 */ 10606 originalUrl: string; 10607 10608 /** 10609 * Referrer. 10610 * 10611 * @type { string } 10612 * @syscap SystemCapability.Web.Webview.Core 10613 * @atomicservice 10614 * @since 12 10615 */ 10616 referrer: string; 10617 10618 /** 10619 * Whether the error is fatal. 10620 * 10621 * @type { boolean } 10622 * @syscap SystemCapability.Web.Webview.Core 10623 * @atomicservice 10624 * @since 12 10625 */ 10626 isFatalError: boolean; 10627 10628 /** 10629 * Whether the request is main frame. 10630 * 10631 * @type { boolean } 10632 * @syscap SystemCapability.Web.Webview.Core 10633 * @atomicservice 10634 * @since 12 10635 */ 10636 isMainFrame: boolean; 10637 10638 /** 10639 * Certificate chain data in DER format. 10640 * 10641 * @type { ?Array<Uint8Array> } 10642 * @syscap SystemCapability.Web.Webview.Core 10643 * @since 20 10644 */ 10645 certChainData?: Array<Uint8Array>; 10646} 10647 10648/** 10649 * Defines the menu item option. 10650 * 10651 * @interface ExpandedMenuItemOptions 10652 * @syscap SystemCapability.Web.Webview.Core 10653 * @atomicservice 10654 * @since 12 10655 * @deprecated since 20 10656 */ 10657declare interface ExpandedMenuItemOptions { 10658 /** 10659 * Customize what the menu displays. 10660 * 10661 * @type { ResourceStr } 10662 * @syscap SystemCapability.Web.Webview.Core 10663 * @atomicservice 10664 * @since 12 10665 * @deprecated since 20 10666 */ 10667 content: ResourceStr; 10668 10669 /** 10670 * Customize the icon before the menu displays content. 10671 * 10672 * @type { ?ResourceStr } 10673 * @syscap SystemCapability.Web.Webview.Core 10674 * @atomicservice 10675 * @since 12 10676 * @deprecated since 20 10677 */ 10678 startIcon?: ResourceStr; 10679 10680 /** 10681 * Get the selected text information. 10682 * 10683 * @type { function } 10684 * @syscap SystemCapability.Web.Webview.Core 10685 * @atomicservice 10686 * @since 12 10687 * @deprecated since 20 10688 */ 10689 action: (selectedText: {plainText: string}) => void; 10690} 10691 10692/** 10693 * Define nested scroll options 10694 * 10695 * @interface NestedScrollOptionsExt 10696 * @syscap SystemCapability.Web.Webview.Core 10697 * @since 14 10698 */ 10699declare interface NestedScrollOptionsExt { 10700 /** 10701 * Set NestedScrollMode when the scrollable component scrolls up 10702 * 10703 * @type { ?NestedScrollMode } 10704 * @syscap SystemCapability.Web.Webview.Core 10705 * @since 14 10706 */ 10707 scrollUp?: NestedScrollMode; 10708 10709 /** 10710 * Set NestedScrollMode when the scrollable component scrolls down 10711 * 10712 * @type { ?NestedScrollMode } 10713 * @syscap SystemCapability.Web.Webview.Core 10714 * @since 14 10715 */ 10716 scrollDown?: NestedScrollMode; 10717 10718 /** 10719 * Set NestedScrollMode when the scrollable component scrolls right 10720 * 10721 * @type { ?NestedScrollMode } 10722 * @syscap SystemCapability.Web.Webview.Core 10723 * @since 14 10724 */ 10725 scrollRight?: NestedScrollMode; 10726 10727 /** 10728 * Set NestedScrollMode when the scrollable component scrolls left 10729 * 10730 * @type { ?NestedScrollMode } 10731 * @syscap SystemCapability.Web.Webview.Core 10732 * @since 14 10733 */ 10734 scrollLeft?: NestedScrollMode; 10735} 10736 10737/** 10738 * Defines the Embed Options. 10739 * 10740 * @typedef EmbedOptions 10741 * @syscap SystemCapability.Web.Webview.Core 10742 * @since 16 10743 */ 10744declare interface EmbedOptions { 10745 /** 10746 * Whether the embed element support the default intrinsic size of 300 * 150, expressed in CSS pixels. 10747 * <br>When CSS size is set, the embed element size is CSS size, otherwise it is intrinsic size. 10748 * <br>If true, then the intrinsic size is 300 * 150. 10749 * <br>If false, the embed element will not be rendered when the CSS size is not set. 10750 * 10751 * @type { ?boolean } 10752 * @default false 10753 * @syscap SystemCapability.Web.Webview.Core 10754 * @since 16 10755 */ 10756 supportDefaultIntrinsicSize?: boolean; 10757 10758 /** 10759 * Whether the {@link onNativeEmbedVisibilityChange} event supports display-related attributes 10760 * of the embed element. 10761 * <br>Default value is false. If true, the changes of the display-related attributes of the 10762 * embed element will be reported through the {@link onNativeEmbedVisibilityChange} event. 10763 * 10764 * @type { ?boolean } 10765 * @default false 10766 * @syscap SystemCapability.Web.Webview.Core 10767 * @since 20 10768 */ 10769 supportCssDisplayChange?: boolean; 10770} 10771 10772/** 10773 * Enum type supplied to {@link gestureFocusMode} for setting the web gesture focus mode. 10774 * 10775 * @enum { number } 10776 * @syscap SystemCapability.Web.Webview.Core 10777 * @since 20 10778 */ 10779declare enum GestureFocusMode { 10780 /** 10781 * Any action on a web component, such as tapping, long-pressing, scrolling, zooming, etc., 10782 * will cause the web component to acquire focus on touch down. 10783 * 10784 * @syscap SystemCapability.Web.Webview.Core 10785 * @since 20 10786 */ 10787 DEFAULT = 0, 10788 10789 /** 10790 * Tap and long-press gestures will cause the web component to acquire focus after touch up, 10791 * while gestures such as scrolling, zooming, etc., do not request focus. 10792 * 10793 * @syscap SystemCapability.Web.Webview.Core 10794 * @since 20 10795 */ 10796 GESTURE_TAP_AND_LONG_PRESS = 1 10797} 10798