From 03ce11f10d7da05f41950fa401d85d998bdd0ac0 Mon Sep 17 00:00:00 2001 From: peiche-jessica Date: Mon, 2 Aug 2021 23:27:36 +0000 Subject: [PATCH 1/3] Initialize Docs repository: https://github.com/MicrosoftDocs/webview2-winrt-reference of branch live --- .openpublishing.publish.config.json | 17 +++++++++- docfx.json | 51 +++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 docfx.json diff --git a/.openpublishing.publish.config.json b/.openpublishing.publish.config.json index b0252e9e..fb395092 100644 --- a/.openpublishing.publish.config.json +++ b/.openpublishing.publish.config.json @@ -1,5 +1,20 @@ { - "docsets_to_publish": [], + "docsets_to_publish": [ + { + "docset_name": "webview2-winrt", + "build_source_folder": ".", + "build_output_subfolder": "webview2-winrt", + "locale": "en-us", + "monikers": [], + "moniker_ranges": [], + "open_to_public_contributors": false, + "type_mapping": { + "Conceptual": "Content" + }, + "build_entry_point": "docs", + "template_folder": "_themes" + } + ], "notification_subscribers": [], "sync_notification_subscribers": [], "branches_to_filter": [], diff --git a/docfx.json b/docfx.json new file mode 100644 index 00000000..52959392 --- /dev/null +++ b/docfx.json @@ -0,0 +1,51 @@ +{ + "build": { + "content": [ + { + "files": [ + "**/*.md", + "**/*.yml" + ], + "exclude": [ + "**/obj/**", + "**/includes/**", + "_themes/**", + "_themes.pdf/**", + "**/docfx.json", + "_repo.en-us/**", + "README.md", + "LICENSE", + "LICENSE-CODE", + "ThirdPartyNotices.md" + ] + } + ], + "resource": [ + { + "files": [ + "**/*.png", + "**/*.jpg" + ], + "exclude": [ + "**/obj/**", + "**/includes/**", + "_themes/**", + "_themes.pdf/**", + "**/docfx.json", + "_repo.en-us/**" + ] + } + ], + "overwrite": [], + "externalReference": [], + "globalMetadata": { + "breadcrumb_path": "/microsoft-edge/webview2/reference/winrt/breadcrumb/toc.json", + "extendBreadcrumb": true, + "feedback_system": "None" + }, + "fileMetadata": {}, + "template": [], + "dest": "webview2-winrt", + "markdownEngineName": "markdig" + } +} \ No newline at end of file From bc3851d04aad93e092b6ff0efcc61e14d781c331 Mon Sep 17 00:00:00 2001 From: Jessica Chen <55165503+peiche-jessica@users.noreply.github.com> Date: Mon, 1 Nov 2021 12:14:01 -0700 Subject: [PATCH 2/3] WebView2: Update documentation for SDK 1.0.1020.30 and 1.0.1056-prerelease (#7) * Added 1.0.1056-prerelease * Added 1.0.1020.30 * Added CoreWebView2EnvironmentOptions ctor reference * Fixed version typo --- .openpublishing.publish.config.json | 2 + .../winrt/corewebview2environmentoptions.md | 8 +- .../winrt/corewebview2settings.md | 4 +- .../winrt/corewebview2controlleroptions.md | 6 +- .../winrt/corewebview2environmentoptions.md | 8 +- .../winrt/corewebview2settings.md | 4 +- ...orewebview2compositioncontrollerinterop.md | 50 ++ .../icorewebview2environmentinterop.md | 34 + 1-0-1020-30/interop/icorewebview2interop.md | 34 + 1-0-1020-30/interop/index.md | 16 + 1-0-1020-30/toc.yml | 144 +++ 1-0-1020-30/winrt/corewebview2.md | 712 +++++++++++++++ ...ewebview2acceleratorkeypressedeventargs.md | 66 ++ 1-0-1020-30/winrt/corewebview2boundsmode.md | 20 + ...rewebview2browserprocessexitedeventargs.md | 42 + .../corewebview2browserprocessexitkind.md | 20 + .../corewebview2capturepreviewimageformat.md | 20 + .../winrt/corewebview2clientcertificate.md | 104 +++ .../corewebview2clientcertificatekind.md | 21 + ...iew2clientcertificaterequestedeventargs.md | 103 +++ .../corewebview2compositioncontroller.md | 75 ++ .../corewebview2contentloadingeventargs.md | 42 + 1-0-1020-30/winrt/corewebview2controller.md | 210 +++++ .../corewebview2controllerwindowreference.md | 67 ++ 1-0-1020-30/winrt/corewebview2cookie.md | 94 ++ .../winrt/corewebview2cookiemanager.md | 95 ++ .../winrt/corewebview2cookiesamesitekind.md | 24 + ...2devtoolsprotocoleventreceivedeventargs.md | 35 + ...rewebview2devtoolsprotocoleventreceiver.md | 36 + .../corewebview2domcontentloadedeventargs.md | 35 + .../corewebview2downloadinterruptreason.md | 48 + .../winrt/corewebview2downloadoperation.md | 159 ++++ .../corewebview2downloadstartingeventargs.md | 71 ++ .../winrt/corewebview2downloadstate.md | 21 + 1-0-1020-30/winrt/corewebview2environment.md | 188 ++++ .../winrt/corewebview2environmentoptions.md | 71 ++ 1-0-1020-30/winrt/corewebview2frame.md | 72 ++ .../corewebview2framecreatedeventargs.md | 35 + 1-0-1020-30/winrt/corewebview2frameinfo.md | 38 + .../corewebview2hostresourceaccesskind.md | 28 + ...rewebview2httpheaderscollectioniterator.md | 55 ++ .../winrt/corewebview2httprequestheaders.md | 82 ++ .../winrt/corewebview2httpresponseheaders.md | 73 ++ 1-0-1020-30/winrt/corewebview2keyeventkind.md | 22 + .../winrt/corewebview2mouseeventkind.md | 34 + .../corewebview2mouseeventvirtualkeys.md | 26 + .../winrt/corewebview2movefocusreason.md | 22 + ...corewebview2movefocusrequestedeventargs.md | 43 + ...orewebview2navigationcompletedeventargs.md | 50 ++ ...corewebview2navigationstartingeventargs.md | 77 ++ ...corewebview2newwindowrequestedeventargs.md | 88 ++ .../winrt/corewebview2permissionkind.md | 25 + ...orewebview2permissionrequestedeventargs.md | 70 ++ .../winrt/corewebview2permissionstate.md | 21 + .../winrt/corewebview2physicalkeystatus.md | 26 + .../winrt/corewebview2pointereventkind.md | 24 + 1-0-1020-30/winrt/corewebview2pointerinfo.md | 251 ++++++ .../winrt/corewebview2printorientation.md | 20 + .../winrt/corewebview2printsettings.md | 133 +++ .../corewebview2processfailedeventargs.md | 68 ++ .../winrt/corewebview2processfailedkind.md | 29 + .../winrt/corewebview2processfailedreason.md | 24 + .../winrt/corewebview2scriptdialogkind.md | 22 + ...orewebview2scriptdialogopeningeventargs.md | 88 ++ 1-0-1020-30/winrt/corewebview2settings.md | 186 ++++ .../corewebview2sourcechangedeventargs.md | 35 + .../winrt/corewebview2weberrorstatus.md | 35 + ...corewebview2webmessagereceivedeventargs.md | 55 ++ .../winrt/corewebview2webresourcecontext.md | 36 + .../winrt/corewebview2webresourcerequest.md | 60 ++ ...rewebview2webresourcerequestedeventargs.md | 64 ++ .../winrt/corewebview2webresourceresponse.md | 58 ++ ...ew2webresourceresponsereceivedeventargs.md | 43 + .../corewebview2webresourceresponseview.md | 64 ++ .../winrt/corewebview2windowfeatures.md | 99 ++ .../winrt/icorewebview2dispatchadapter.md | 66 ++ 1-0-1020-30/winrt/index.md | 89 ++ ...orewebview2compositioncontrollerinterop.md | 50 ++ .../icorewebview2environmentinterop.md | 34 + .../interop/icorewebview2interop.md | 34 + 1-0-1056-prerelease/interop/index.md | 16 + 1-0-1056-prerelease/toc.yml | 172 ++++ 1-0-1056-prerelease/winrt/corewebview2.md | 848 ++++++++++++++++++ ...ewebview2acceleratorkeypressedeventargs.md | 66 ++ ...w2basicauthenticationrequestedeventargs.md | 63 ++ ...corewebview2basicauthenticationresponse.md | 42 + .../winrt/corewebview2boundsmode.md | 20 + ...rewebview2browserprocessexitedeventargs.md | 42 + .../corewebview2browserprocessexitkind.md | 20 + .../corewebview2capturepreviewimageformat.md | 20 + .../winrt/corewebview2clientcertificate.md | 104 +++ .../corewebview2clientcertificatekind.md | 21 + ...iew2clientcertificaterequestedeventargs.md | 103 +++ .../corewebview2compositioncontroller.md | 119 +++ .../corewebview2contentloadingeventargs.md | 43 + .../winrt/corewebview2contextmenuitem.md | 113 +++ .../winrt/corewebview2contextmenuitemkind.md | 24 + ...rewebview2contextmenurequestedeventargs.md | 78 ++ .../winrt/corewebview2contextmenutarget.md | 119 +++ .../corewebview2contextmenutargetkind.md | 23 + .../winrt/corewebview2controller.md | 218 +++++ .../winrt/corewebview2controlleroptions.md | 44 + .../corewebview2controllerwindowreference.md | 68 ++ .../winrt/corewebview2cookie.md | 94 ++ .../winrt/corewebview2cookiemanager.md | 95 ++ .../winrt/corewebview2cookiesamesitekind.md | 24 + ...ew2defaultdownloaddialogcorneralignment.md | 22 + ...2devtoolsprotocoleventreceivedeventargs.md | 35 + ...rewebview2devtoolsprotocoleventreceiver.md | 36 + .../corewebview2domcontentloadedeventargs.md | 36 + .../corewebview2downloadinterruptreason.md | 48 + .../winrt/corewebview2downloadoperation.md | 159 ++++ .../corewebview2downloadstartingeventargs.md | 71 ++ .../winrt/corewebview2downloadstate.md | 21 + .../winrt/corewebview2environment.md | 266 ++++++ .../winrt/corewebview2environmentoptions.md | 78 ++ .../winrt/corewebview2frame.md | 116 +++ .../corewebview2framecreatedeventargs.md | 35 + .../winrt/corewebview2frameinfo.md | 38 + .../corewebview2hostresourceaccesskind.md | 28 + ...rewebview2httpheaderscollectioniterator.md | 55 ++ .../winrt/corewebview2httprequestheaders.md | 82 ++ .../winrt/corewebview2httpresponseheaders.md | 73 ++ .../winrt/corewebview2keyeventkind.md | 22 + .../corewebview2memoryusagetargetlevel.md | 20 + .../winrt/corewebview2mouseeventkind.md | 34 + .../corewebview2mouseeventvirtualkeys.md | 26 + .../winrt/corewebview2movefocusreason.md | 22 + ...corewebview2movefocusrequestedeventargs.md | 43 + ...orewebview2navigationcompletedeventargs.md | 51 ++ ...corewebview2navigationstartingeventargs.md | 78 ++ ...corewebview2newwindowrequestedeventargs.md | 88 ++ .../winrt/corewebview2pdftoolbaritems.md | 22 + .../winrt/corewebview2permissionkind.md | 25 + ...orewebview2permissionrequestedeventargs.md | 70 ++ .../winrt/corewebview2permissionstate.md | 21 + .../winrt/corewebview2physicalkeystatus.md | 26 + .../winrt/corewebview2pointereventkind.md | 24 + .../winrt/corewebview2pointerinfo.md | 251 ++++++ .../winrt/corewebview2printorientation.md | 20 + .../winrt/corewebview2printsettings.md | 133 +++ .../corewebview2processfailedeventargs.md | 68 ++ .../winrt/corewebview2processfailedkind.md | 29 + .../winrt/corewebview2processfailedreason.md | 24 + .../winrt/corewebview2profile.md | 49 + .../winrt/corewebview2scriptdialogkind.md | 22 + ...orewebview2scriptdialogopeningeventargs.md | 88 ++ .../winrt/corewebview2settings.md | 196 ++++ .../corewebview2sourcechangedeventargs.md | 35 + .../winrt/corewebview2updateruntimeresult.md | 37 + .../winrt/corewebview2updateruntimestatus.md | 22 + .../winrt/corewebview2weberrorstatus.md | 35 + ...corewebview2webmessagereceivedeventargs.md | 55 ++ .../winrt/corewebview2webresourcecontext.md | 36 + .../winrt/corewebview2webresourcerequest.md | 60 ++ ...rewebview2webresourcerequestedeventargs.md | 64 ++ .../winrt/corewebview2webresourceresponse.md | 58 ++ ...ew2webresourceresponsereceivedeventargs.md | 43 + .../corewebview2webresourceresponseview.md | 64 ++ .../winrt/corewebview2windowfeatures.md | 99 ++ .../winrt/icorewebview2dispatchadapter.md | 66 ++ 1-0-1056-prerelease/winrt/index.md | 103 +++ .../winrt/corewebview2environmentoptions.md | 8 +- .../winrt/corewebview2settings.md | 4 +- .../winrt/corewebview2environmentoptions.md | 8 +- 1-0-992-28/winrt/corewebview2settings.md | 4 +- docfx.json | 8 + 167 files changed, 11273 insertions(+), 29 deletions(-) create mode 100644 1-0-1020-30/interop/icorewebview2compositioncontrollerinterop.md create mode 100644 1-0-1020-30/interop/icorewebview2environmentinterop.md create mode 100644 1-0-1020-30/interop/icorewebview2interop.md create mode 100644 1-0-1020-30/interop/index.md create mode 100644 1-0-1020-30/toc.yml create mode 100644 1-0-1020-30/winrt/corewebview2.md create mode 100644 1-0-1020-30/winrt/corewebview2acceleratorkeypressedeventargs.md create mode 100644 1-0-1020-30/winrt/corewebview2boundsmode.md create mode 100644 1-0-1020-30/winrt/corewebview2browserprocessexitedeventargs.md create mode 100644 1-0-1020-30/winrt/corewebview2browserprocessexitkind.md create mode 100644 1-0-1020-30/winrt/corewebview2capturepreviewimageformat.md create mode 100644 1-0-1020-30/winrt/corewebview2clientcertificate.md create mode 100644 1-0-1020-30/winrt/corewebview2clientcertificatekind.md create mode 100644 1-0-1020-30/winrt/corewebview2clientcertificaterequestedeventargs.md create mode 100644 1-0-1020-30/winrt/corewebview2compositioncontroller.md create mode 100644 1-0-1020-30/winrt/corewebview2contentloadingeventargs.md create mode 100644 1-0-1020-30/winrt/corewebview2controller.md create mode 100644 1-0-1020-30/winrt/corewebview2controllerwindowreference.md create mode 100644 1-0-1020-30/winrt/corewebview2cookie.md create mode 100644 1-0-1020-30/winrt/corewebview2cookiemanager.md create mode 100644 1-0-1020-30/winrt/corewebview2cookiesamesitekind.md create mode 100644 1-0-1020-30/winrt/corewebview2devtoolsprotocoleventreceivedeventargs.md create mode 100644 1-0-1020-30/winrt/corewebview2devtoolsprotocoleventreceiver.md create mode 100644 1-0-1020-30/winrt/corewebview2domcontentloadedeventargs.md create mode 100644 1-0-1020-30/winrt/corewebview2downloadinterruptreason.md create mode 100644 1-0-1020-30/winrt/corewebview2downloadoperation.md create mode 100644 1-0-1020-30/winrt/corewebview2downloadstartingeventargs.md create mode 100644 1-0-1020-30/winrt/corewebview2downloadstate.md create mode 100644 1-0-1020-30/winrt/corewebview2environment.md create mode 100644 1-0-1020-30/winrt/corewebview2environmentoptions.md create mode 100644 1-0-1020-30/winrt/corewebview2frame.md create mode 100644 1-0-1020-30/winrt/corewebview2framecreatedeventargs.md create mode 100644 1-0-1020-30/winrt/corewebview2frameinfo.md create mode 100644 1-0-1020-30/winrt/corewebview2hostresourceaccesskind.md create mode 100644 1-0-1020-30/winrt/corewebview2httpheaderscollectioniterator.md create mode 100644 1-0-1020-30/winrt/corewebview2httprequestheaders.md create mode 100644 1-0-1020-30/winrt/corewebview2httpresponseheaders.md create mode 100644 1-0-1020-30/winrt/corewebview2keyeventkind.md create mode 100644 1-0-1020-30/winrt/corewebview2mouseeventkind.md create mode 100644 1-0-1020-30/winrt/corewebview2mouseeventvirtualkeys.md create mode 100644 1-0-1020-30/winrt/corewebview2movefocusreason.md create mode 100644 1-0-1020-30/winrt/corewebview2movefocusrequestedeventargs.md create mode 100644 1-0-1020-30/winrt/corewebview2navigationcompletedeventargs.md create mode 100644 1-0-1020-30/winrt/corewebview2navigationstartingeventargs.md create mode 100644 1-0-1020-30/winrt/corewebview2newwindowrequestedeventargs.md create mode 100644 1-0-1020-30/winrt/corewebview2permissionkind.md create mode 100644 1-0-1020-30/winrt/corewebview2permissionrequestedeventargs.md create mode 100644 1-0-1020-30/winrt/corewebview2permissionstate.md create mode 100644 1-0-1020-30/winrt/corewebview2physicalkeystatus.md create mode 100644 1-0-1020-30/winrt/corewebview2pointereventkind.md create mode 100644 1-0-1020-30/winrt/corewebview2pointerinfo.md create mode 100644 1-0-1020-30/winrt/corewebview2printorientation.md create mode 100644 1-0-1020-30/winrt/corewebview2printsettings.md create mode 100644 1-0-1020-30/winrt/corewebview2processfailedeventargs.md create mode 100644 1-0-1020-30/winrt/corewebview2processfailedkind.md create mode 100644 1-0-1020-30/winrt/corewebview2processfailedreason.md create mode 100644 1-0-1020-30/winrt/corewebview2scriptdialogkind.md create mode 100644 1-0-1020-30/winrt/corewebview2scriptdialogopeningeventargs.md create mode 100644 1-0-1020-30/winrt/corewebview2settings.md create mode 100644 1-0-1020-30/winrt/corewebview2sourcechangedeventargs.md create mode 100644 1-0-1020-30/winrt/corewebview2weberrorstatus.md create mode 100644 1-0-1020-30/winrt/corewebview2webmessagereceivedeventargs.md create mode 100644 1-0-1020-30/winrt/corewebview2webresourcecontext.md create mode 100644 1-0-1020-30/winrt/corewebview2webresourcerequest.md create mode 100644 1-0-1020-30/winrt/corewebview2webresourcerequestedeventargs.md create mode 100644 1-0-1020-30/winrt/corewebview2webresourceresponse.md create mode 100644 1-0-1020-30/winrt/corewebview2webresourceresponsereceivedeventargs.md create mode 100644 1-0-1020-30/winrt/corewebview2webresourceresponseview.md create mode 100644 1-0-1020-30/winrt/corewebview2windowfeatures.md create mode 100644 1-0-1020-30/winrt/icorewebview2dispatchadapter.md create mode 100644 1-0-1020-30/winrt/index.md create mode 100644 1-0-1056-prerelease/interop/icorewebview2compositioncontrollerinterop.md create mode 100644 1-0-1056-prerelease/interop/icorewebview2environmentinterop.md create mode 100644 1-0-1056-prerelease/interop/icorewebview2interop.md create mode 100644 1-0-1056-prerelease/interop/index.md create mode 100644 1-0-1056-prerelease/toc.yml create mode 100644 1-0-1056-prerelease/winrt/corewebview2.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2acceleratorkeypressedeventargs.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2basicauthenticationrequestedeventargs.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2basicauthenticationresponse.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2boundsmode.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2browserprocessexitedeventargs.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2browserprocessexitkind.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2capturepreviewimageformat.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2clientcertificate.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2clientcertificatekind.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2clientcertificaterequestedeventargs.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2compositioncontroller.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2contentloadingeventargs.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2contextmenuitem.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2contextmenuitemkind.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2contextmenurequestedeventargs.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2contextmenutarget.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2contextmenutargetkind.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2controller.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2controlleroptions.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2controllerwindowreference.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2cookie.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2cookiemanager.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2cookiesamesitekind.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2defaultdownloaddialogcorneralignment.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2devtoolsprotocoleventreceivedeventargs.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2devtoolsprotocoleventreceiver.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2domcontentloadedeventargs.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2downloadinterruptreason.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2downloadoperation.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2downloadstartingeventargs.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2downloadstate.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2environment.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2environmentoptions.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2frame.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2framecreatedeventargs.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2frameinfo.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2hostresourceaccesskind.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2httpheaderscollectioniterator.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2httprequestheaders.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2httpresponseheaders.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2keyeventkind.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2memoryusagetargetlevel.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2mouseeventkind.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2mouseeventvirtualkeys.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2movefocusreason.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2movefocusrequestedeventargs.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2navigationcompletedeventargs.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2navigationstartingeventargs.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2newwindowrequestedeventargs.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2pdftoolbaritems.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2permissionkind.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2permissionrequestedeventargs.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2permissionstate.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2physicalkeystatus.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2pointereventkind.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2pointerinfo.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2printorientation.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2printsettings.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2processfailedeventargs.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2processfailedkind.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2processfailedreason.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2profile.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2scriptdialogkind.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2scriptdialogopeningeventargs.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2settings.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2sourcechangedeventargs.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2updateruntimeresult.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2updateruntimestatus.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2weberrorstatus.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2webmessagereceivedeventargs.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2webresourcecontext.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2webresourcerequest.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2webresourcerequestedeventargs.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2webresourceresponse.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2webresourceresponsereceivedeventargs.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2webresourceresponseview.md create mode 100644 1-0-1056-prerelease/winrt/corewebview2windowfeatures.md create mode 100644 1-0-1056-prerelease/winrt/icorewebview2dispatchadapter.md create mode 100644 1-0-1056-prerelease/winrt/index.md diff --git a/.openpublishing.publish.config.json b/.openpublishing.publish.config.json index 4ef8ee6e..0c097667 100644 --- a/.openpublishing.publish.config.json +++ b/.openpublishing.publish.config.json @@ -7,6 +7,8 @@ "locale": "en-us", "monikers": [], "moniker_ranges": [ + "webview2-winrt-1.0.1056-prerelease", + "webview2-winrt-1.0.1020.30", "webview2-winrt-1.0.1018-prerelease", "webview2-winrt-1.0.1010-prerelease", "webview2-winrt-1.0.992.28", diff --git a/1-0-1010-prerelease/winrt/corewebview2environmentoptions.md b/1-0-1010-prerelease/winrt/corewebview2environmentoptions.md index 14c62d11..06737475 100644 --- a/1-0-1010-prerelease/winrt/corewebview2environmentoptions.md +++ b/1-0-1010-prerelease/winrt/corewebview2environmentoptions.md @@ -21,6 +21,7 @@ Members|Description [ExclusiveUserDataFolderAccess](#exclusiveuserdatafolderaccess) | Determines whether other processes can create [CoreWebView2Controller](corewebview2controller.md) from [CoreWebView2Environment](corewebview2environment.md) created with the same user data folder and therefore sharing the same WebView browser process instance. [Language](#language) | Gets or sets the default display language for WebView. [TargetCompatibleBrowserVersion](#targetcompatiblebrowserversion) | Gets or sets the version of the WebView2 Runtime binaries required to be compatible with your app. +[CoreWebView2EnvironmentOptions](#corewebview2environmentoptions) | Initializes a new instance of the CoreWebView2EnvironmentOptions class. ## Properties @@ -66,15 +67,12 @@ This defaults to the WebView2 Runtime version that corresponds with the version ## Constructors + ### CoreWebView2EnvironmentOptions > CoreWebView2EnvironmentOptions() - - - - - +Initializes a new instance of the CoreWebView2EnvironmentOptions class. ## Referenced by diff --git a/1-0-1010-prerelease/winrt/corewebview2settings.md b/1-0-1010-prerelease/winrt/corewebview2settings.md index 15972729..226ff05b 100644 --- a/1-0-1010-prerelease/winrt/corewebview2settings.md +++ b/1-0-1010-prerelease/winrt/corewebview2settings.md @@ -22,7 +22,7 @@ Members|Description [AreDevToolsEnabled](#aredevtoolsenabled) | Determines whether the user is able to use the context menu or keyboard shortcuts to open the DevTools window. [AreHostObjectsAllowed](#arehostobjectsallowed) | Determines whether host objects are accessible from the page in WebView. [HiddenPdfToolbarItems](#hiddenpdftoolbaritems) | Used to customize the PDF toolbar items. -[HostObjectDispatchAdapter](#hostobjectdispatchadapter) | +[HostObjectDispatchAdapter](#hostobjectdispatchadapter) | The default adapter to be used when passing IInspectable objects to [CoreWebView2.AddHostObjectToScript](corewebview2.md#addhostobjecttoscript). [IsBuiltInErrorPageEnabled](#isbuiltinerrorpageenabled) | Determines whether to disable built in error page for navigation failure and render process failure. [IsGeneralAutofillEnabled](#isgeneralautofillenabled) | Determines whether general form information will be saved and autofilled. [IsPasswordAutosaveEnabled](#ispasswordautosaveenabled) | Determines whether password information will be autosaved. @@ -107,6 +107,8 @@ Changes to this setting apply only after the next navigation. > [ICoreWebView2DispatchAdapter](icorewebview2dispatchadapter.md) HostObjectDispatchAdapter +The default adapter to be used when passing IInspectable objects to [CoreWebView2.AddHostObjectToScript](corewebview2.md#addhostobjecttoscript). + ### IsBuiltInErrorPageEnabled > bool IsBuiltInErrorPageEnabled diff --git a/1-0-1018-prerelease/winrt/corewebview2controlleroptions.md b/1-0-1018-prerelease/winrt/corewebview2controlleroptions.md index 0c794825..b98ac20d 100644 --- a/1-0-1018-prerelease/winrt/corewebview2controlleroptions.md +++ b/1-0-1018-prerelease/winrt/corewebview2controlleroptions.md @@ -36,12 +36,8 @@ Manage the name of the controller's profile. * alphabet characters: a-z and A-Z * digit characters: 0-9 * and '#', '@', '', '(', ')', '+', '-', '_', '~', '.', ' ' (space). -Note: the text must not end with a period '.' or ' ' (space). And, although upper-case letters are allowed, they're treated just as lower-case counterparts because the profile name will be mapped to the real profile directory path on disk and Windows file system handles path names in a case-insensitive way. - - - - +Note: the text must not end with a period '.' or ' ' (space). And, although upper-case letters are allowed, they're treated just as lower-case counterparts because the profile name will be mapped to the real profile directory path on disk and Windows file system handles path names in a case-insensitive way. ## Referenced by diff --git a/1-0-1018-prerelease/winrt/corewebview2environmentoptions.md b/1-0-1018-prerelease/winrt/corewebview2environmentoptions.md index 207935a2..e6c66564 100644 --- a/1-0-1018-prerelease/winrt/corewebview2environmentoptions.md +++ b/1-0-1018-prerelease/winrt/corewebview2environmentoptions.md @@ -21,6 +21,7 @@ Members|Description [ExclusiveUserDataFolderAccess](#exclusiveuserdatafolderaccess) | Determines whether other processes can create [CoreWebView2Controller](corewebview2controller.md) from [CoreWebView2Environment](corewebview2environment.md) created with the same user data folder and therefore sharing the same WebView browser process instance. [Language](#language) | Gets or sets the default display language for WebView. [TargetCompatibleBrowserVersion](#targetcompatiblebrowserversion) | Gets or sets the version of the WebView2 Runtime binaries required to be compatible with your app. +[CoreWebView2EnvironmentOptions](#corewebview2environmentoptions) | Initializes a new instance of the CoreWebView2EnvironmentOptions class. ## Properties @@ -66,15 +67,12 @@ This defaults to the WebView2 Runtime version that corresponds with the version ## Constructors + ### CoreWebView2EnvironmentOptions > CoreWebView2EnvironmentOptions() - - - - - +Initializes a new instance of the CoreWebView2EnvironmentOptions class. ## Referenced by diff --git a/1-0-1018-prerelease/winrt/corewebview2settings.md b/1-0-1018-prerelease/winrt/corewebview2settings.md index 57182862..88a5adc8 100644 --- a/1-0-1018-prerelease/winrt/corewebview2settings.md +++ b/1-0-1018-prerelease/winrt/corewebview2settings.md @@ -22,7 +22,7 @@ Members|Description [AreDevToolsEnabled](#aredevtoolsenabled) | Determines whether the user is able to use the context menu or keyboard shortcuts to open the DevTools window. [AreHostObjectsAllowed](#arehostobjectsallowed) | Determines whether host objects are accessible from the page in WebView. [HiddenPdfToolbarItems](#hiddenpdftoolbaritems) | Used to customize the PDF toolbar items. -[HostObjectDispatchAdapter](#hostobjectdispatchadapter) | +[HostObjectDispatchAdapter](#hostobjectdispatchadapter) | The default adapter to be used when passing IInspectable objects to [CoreWebView2.AddHostObjectToScript](corewebview2.md#addhostobjecttoscript). [IsBuiltInErrorPageEnabled](#isbuiltinerrorpageenabled) | Determines whether to disable built in error page for navigation failure and render process failure. [IsGeneralAutofillEnabled](#isgeneralautofillenabled) | Determines whether general form information will be saved and autofilled. [IsPasswordAutosaveEnabled](#ispasswordautosaveenabled) | Determines whether password information will be autosaved. @@ -107,6 +107,8 @@ Changes to this setting apply only after the next navigation. > [ICoreWebView2DispatchAdapter](icorewebview2dispatchadapter.md) HostObjectDispatchAdapter +The default adapter to be used when passing IInspectable objects to [CoreWebView2.AddHostObjectToScript](corewebview2.md#addhostobjecttoscript). + ### IsBuiltInErrorPageEnabled > bool IsBuiltInErrorPageEnabled diff --git a/1-0-1020-30/interop/icorewebview2compositioncontrollerinterop.md b/1-0-1020-30/interop/icorewebview2compositioncontrollerinterop.md new file mode 100644 index 00000000..c86197c4 --- /dev/null +++ b/1-0-1020-30/interop/icorewebview2compositioncontrollerinterop.md @@ -0,0 +1,50 @@ +--- +description: Interop interface for the CoreWebView2CompositionController WinRT object to allow WinRT end developers to be able to use the COM interfaces as parameters for some methods. +title: WebView2 WinRT COM ICoreWebView2CompositionControllerInterop +ms.date: 10/28/2021 +keywords: IWebView2, IWebView2WebView, webview2, webview, winrt, interop, edge, ICoreWebView2, ICoreWebView2Controller, browser control, edge html, ICoreWebView2CompositionControllerInterop +--- + +# interface ICoreWebView2CompositionControllerInterop + +``` +interface ICoreWebView2CompositionControllerInterop + : public IUnknown +``` + +Interop interface for the CoreWebView2CompositionController WinRT object to allow WinRT end developers to be able to use the COM interfaces as parameters for some methods. + +## Summary + + Members | Descriptions +--------------------------------|--------------------------------------------- +[get_RootVisualTarget](#get_rootvisualtarget) | The RootVisualTarget is a visual in the hosting app's visual tree. +[get_UIAProvider](#get_uiaprovider) | Returns the UI Automation Provider for the WebView. +[put_RootVisualTarget](#put_rootvisualtarget) | Set the RootVisualTarget property. + +This interface is implemented by the Microsoft.Web.WebView2.Core.CoreWebView2CompositionController runtime class. + +## Members + +#### get_RootVisualTarget + +The RootVisualTarget is a visual in the hosting app's visual tree. + +> public HRESULT [get_RootVisualTarget](#get_rootvisualtarget)(IUnknown ** target) + +This visual is where the WebView2 will connect its visual tree. See the documentation for ICoreWebView2CompositionController::RootVisualTarget for more information. + +#### get_UIAProvider + +Returns the UI Automation Provider for the WebView. + +> public HRESULT [get_UIAProvider](#get_uiaprovider)(IUnknown ** provider) + +See the documentation for ICoreWebView2CompositionController::UIAProvider for more information. + +#### put_RootVisualTarget + +Set the RootVisualTarget property. + +> public HRESULT [put_RootVisualTarget](#put_rootvisualtarget)(IUnknown * target) + diff --git a/1-0-1020-30/interop/icorewebview2environmentinterop.md b/1-0-1020-30/interop/icorewebview2environmentinterop.md new file mode 100644 index 00000000..1304cdff --- /dev/null +++ b/1-0-1020-30/interop/icorewebview2environmentinterop.md @@ -0,0 +1,34 @@ +--- +description: Interop interface for the CoreWebView2Environment WinRT object to allow WinRT end developers to be able to use COM interfaces as parameters for some methods. +title: WebView2 WinRT COM ICoreWebView2EnvironmentInterop +ms.date: 10/28/2021 +keywords: IWebView2, IWebView2WebView, webview2, webview, winrt, interop, edge, ICoreWebView2, ICoreWebView2Controller, browser control, edge html, ICoreWebView2EnvironmentInterop +--- + +# interface ICoreWebView2EnvironmentInterop + +``` +interface ICoreWebView2EnvironmentInterop + : public IUnknown +``` + +Interop interface for the CoreWebView2Environment WinRT object to allow WinRT end developers to be able to use COM interfaces as parameters for some methods. + +## Summary + + Members | Descriptions +--------------------------------|--------------------------------------------- +[GetProviderForHwnd](#getproviderforhwnd) | Returns the UI Automation Provider for the ICoreWebView2CompositionController that corresponds with the given HWND. + +This interface is implemented by the Microsoft.Web.WebView2.Core.CoreWebView2Environment runtime class. + +## Members + +#### GetProviderForHwnd + +Returns the UI Automation Provider for the ICoreWebView2CompositionController that corresponds with the given HWND. + +> public HRESULT [GetProviderForHwnd](#getproviderforhwnd)(HWND hwnd,IUnknown ** provider) + +See the documentation for ICoreWebView2Environment::GetProviderForHwnd for more information. + diff --git a/1-0-1020-30/interop/icorewebview2interop.md b/1-0-1020-30/interop/icorewebview2interop.md new file mode 100644 index 00000000..b20c107f --- /dev/null +++ b/1-0-1020-30/interop/icorewebview2interop.md @@ -0,0 +1,34 @@ +--- +description: Interop interface for the CoreWebView2 WinRT object to allow WinRT end developers to be able to use COM interfaces as parameters for some methods. +title: WebView2 WinRT COM ICoreWebView2Interop +ms.date: 10/28/2021 +keywords: IWebView2, IWebView2WebView, webview2, webview, winrt, interop, edge, ICoreWebView2, ICoreWebView2Controller, browser control, edge html, ICoreWebView2Interop +--- + +# interface ICoreWebView2Interop + +``` +interface ICoreWebView2Interop + : public IUnknown +``` + +Interop interface for the CoreWebView2 WinRT object to allow WinRT end developers to be able to use COM interfaces as parameters for some methods. + +## Summary + + Members | Descriptions +--------------------------------|--------------------------------------------- +[AddHostObjectToScript](#addhostobjecttoscript) | Add the provided host object to script running in the WebView with the specified name. + +This interface is implemented by the Microsoft.Web.WebView2.Core.CoreWebView2 runtime class. + +## Members + +#### AddHostObjectToScript + +Add the provided host object to script running in the WebView with the specified name. + +> public HRESULT [AddHostObjectToScript](#addhostobjecttoscript)(LPCWSTR name,VARIANT * object) + +See the documentation for ICoreWebView2::AddHostObjectToScript for more information. + diff --git a/1-0-1020-30/interop/index.md b/1-0-1020-30/interop/index.md new file mode 100644 index 00000000..22a42b7e --- /dev/null +++ b/1-0-1020-30/interop/index.md @@ -0,0 +1,16 @@ +--- +description: WebView2 WinRT COM Interop Reference +title: WebView2 WinRT COM Interop Reference +ms.date: 10/28/2021 +keywords: IWebView2, IWebView2WebView, webview2, webview, winrt, interop, edge, ICoreWebView2, ICoreWebView2Controller, ICoreWebView2Interop, browser control, edge html +--- + +# WebView2 WinRT COM Interop Reference + +The Microsoft Edge WebView2 control enables you to host web content in your application using [Microsoft Edge \(Chromium\)](https://www.microsoftedgeinsider.com) as the rendering engine. For more information, see [Overview of Microsoft Edge WebView2](/microsoft-edge/webview2/index)) and [Getting Started with WebView2](/microsoft-edge/webview2/gettingstarted/win32). + +## Interfaces + +* [ICoreWebView2CompositionControllerInterop](icorewebview2compositioncontrollerinterop.md) +* [ICoreWebView2EnvironmentInterop](icorewebview2environmentinterop.md) +* [ICoreWebView2Interop](icorewebview2interop.md) diff --git a/1-0-1020-30/toc.yml b/1-0-1020-30/toc.yml new file mode 100644 index 00000000..3f678735 --- /dev/null +++ b/1-0-1020-30/toc.yml @@ -0,0 +1,144 @@ +- name: WebView2 WinRT Reference + items: + - name: Microsoft.Web.WebView2.Core Namespace + href: winrt/index.md + items: + - name: CoreWebView2 + href: winrt/corewebview2.md + - name: CoreWebView2AcceleratorKeyPressedEventArgs + href: winrt/corewebview2acceleratorkeypressedeventargs.md + - name: CoreWebView2BoundsMode + href: winrt/corewebview2boundsmode.md + - name: CoreWebView2BrowserProcessExitedEventArgs + href: winrt/corewebview2browserprocessexitedeventargs.md + - name: CoreWebView2BrowserProcessExitKind + href: winrt/corewebview2browserprocessexitkind.md + - name: CoreWebView2CapturePreviewImageFormat + href: winrt/corewebview2capturepreviewimageformat.md + - name: CoreWebView2ClientCertificate + href: winrt/corewebview2clientcertificate.md + - name: CoreWebView2ClientCertificateKind + href: winrt/corewebview2clientcertificatekind.md + - name: CoreWebView2ClientCertificateRequestedEventArgs + href: winrt/corewebview2clientcertificaterequestedeventargs.md + - name: CoreWebView2CompositionController + href: winrt/corewebview2compositioncontroller.md + - name: CoreWebView2ContentLoadingEventArgs + href: winrt/corewebview2contentloadingeventargs.md + - name: CoreWebView2Controller + href: winrt/corewebview2controller.md + - name: CoreWebView2ControllerWindowReference + href: winrt/corewebview2controllerwindowreference.md + - name: CoreWebView2Cookie + href: winrt/corewebview2cookie.md + - name: CoreWebView2CookieManager + href: winrt/corewebview2cookiemanager.md + - name: CoreWebView2CookieSameSiteKind + href: winrt/corewebview2cookiesamesitekind.md + - name: CoreWebView2DevToolsProtocolEventReceivedEventArgs + href: winrt/corewebview2devtoolsprotocoleventreceivedeventargs.md + - name: CoreWebView2DevToolsProtocolEventReceiver + href: winrt/corewebview2devtoolsprotocoleventreceiver.md + - name: CoreWebView2DOMContentLoadedEventArgs + href: winrt/corewebview2domcontentloadedeventargs.md + - name: CoreWebView2DownloadInterruptReason + href: winrt/corewebview2downloadinterruptreason.md + - name: CoreWebView2DownloadOperation + href: winrt/corewebview2downloadoperation.md + - name: CoreWebView2DownloadStartingEventArgs + href: winrt/corewebview2downloadstartingeventargs.md + - name: CoreWebView2DownloadState + href: winrt/corewebview2downloadstate.md + - name: CoreWebView2Environment + href: winrt/corewebview2environment.md + - name: CoreWebView2EnvironmentOptions + href: winrt/corewebview2environmentoptions.md + - name: CoreWebView2Frame + href: winrt/corewebview2frame.md + - name: CoreWebView2FrameCreatedEventArgs + href: winrt/corewebview2framecreatedeventargs.md + - name: CoreWebView2FrameInfo + href: winrt/corewebview2frameinfo.md + - name: CoreWebView2HostResourceAccessKind + href: winrt/corewebview2hostresourceaccesskind.md + - name: CoreWebView2HttpHeadersCollectionIterator + href: winrt/corewebview2httpheaderscollectioniterator.md + - name: CoreWebView2HttpRequestHeaders + href: winrt/corewebview2httprequestheaders.md + - name: CoreWebView2HttpResponseHeaders + href: winrt/corewebview2httpresponseheaders.md + - name: CoreWebView2KeyEventKind + href: winrt/corewebview2keyeventkind.md + - name: CoreWebView2MouseEventKind + href: winrt/corewebview2mouseeventkind.md + - name: CoreWebView2MouseEventVirtualKeys + href: winrt/corewebview2mouseeventvirtualkeys.md + - name: CoreWebView2MoveFocusReason + href: winrt/corewebview2movefocusreason.md + - name: CoreWebView2MoveFocusRequestedEventArgs + href: winrt/corewebview2movefocusrequestedeventargs.md + - name: CoreWebView2NavigationCompletedEventArgs + href: winrt/corewebview2navigationcompletedeventargs.md + - name: CoreWebView2NavigationStartingEventArgs + href: winrt/corewebview2navigationstartingeventargs.md + - name: CoreWebView2NewWindowRequestedEventArgs + href: winrt/corewebview2newwindowrequestedeventargs.md + - name: CoreWebView2PermissionKind + href: winrt/corewebview2permissionkind.md + - name: CoreWebView2PermissionRequestedEventArgs + href: winrt/corewebview2permissionrequestedeventargs.md + - name: CoreWebView2PermissionState + href: winrt/corewebview2permissionstate.md + - name: CoreWebView2PhysicalKeyStatus + href: winrt/corewebview2physicalkeystatus.md + - name: CoreWebView2PointerEventKind + href: winrt/corewebview2pointereventkind.md + - name: CoreWebView2PointerInfo + href: winrt/corewebview2pointerinfo.md + - name: CoreWebView2PrintOrientation + href: winrt/corewebview2printorientation.md + - name: CoreWebView2PrintSettings + href: winrt/corewebview2printsettings.md + - name: CoreWebView2ProcessFailedEventArgs + href: winrt/corewebview2processfailedeventargs.md + - name: CoreWebView2ProcessFailedKind + href: winrt/corewebview2processfailedkind.md + - name: CoreWebView2ProcessFailedReason + href: winrt/corewebview2processfailedreason.md + - name: CoreWebView2ScriptDialogKind + href: winrt/corewebview2scriptdialogkind.md + - name: CoreWebView2ScriptDialogOpeningEventArgs + href: winrt/corewebview2scriptdialogopeningeventargs.md + - name: CoreWebView2Settings + href: winrt/corewebview2settings.md + - name: CoreWebView2SourceChangedEventArgs + href: winrt/corewebview2sourcechangedeventargs.md + - name: CoreWebView2WebErrorStatus + href: winrt/corewebview2weberrorstatus.md + - name: CoreWebView2WebMessageReceivedEventArgs + href: winrt/corewebview2webmessagereceivedeventargs.md + - name: CoreWebView2WebResourceContext + href: winrt/corewebview2webresourcecontext.md + - name: CoreWebView2WebResourceRequest + href: winrt/corewebview2webresourcerequest.md + - name: CoreWebView2WebResourceRequestedEventArgs + href: winrt/corewebview2webresourcerequestedeventargs.md + - name: CoreWebView2WebResourceResponse + href: winrt/corewebview2webresourceresponse.md + - name: CoreWebView2WebResourceResponseReceivedEventArgs + href: winrt/corewebview2webresourceresponsereceivedeventargs.md + - name: CoreWebView2WebResourceResponseView + href: winrt/corewebview2webresourceresponseview.md + - name: CoreWebView2WindowFeatures + href: winrt/corewebview2windowfeatures.md + - name: ICoreWebView2DispatchAdapter + href: winrt/icorewebview2dispatchadapter.md + - name: COM Interop APIs + href: interop/index.md + items: + - name: ICoreWebView2CompositionControllerInterop + href: interop/icorewebview2compositioncontrollerinterop.md + - name: ICoreWebView2EnvironmentInterop + href: interop/icorewebview2environmentinterop.md + - name: ICoreWebView2Interop + href: interop/icorewebview2interop.md diff --git a/1-0-1020-30/winrt/corewebview2.md b/1-0-1020-30/winrt/corewebview2.md new file mode 100644 index 00000000..4f32160c --- /dev/null +++ b/1-0-1020-30/winrt/corewebview2.md @@ -0,0 +1,712 @@ +--- +description: WebView2 enables you to host web content using the latest Microsoft Edge browser and web technology. +title: CoreWebView2 +ms.date: 10/28/2021 +keywords: webview2, webview, winrt, win32, edge, CoreWebView2, CoreWebView2Controller, browser control, edge html, CoreWebView2 +--- + +# CoreWebView2 Class + + + +WebView2 enables you to host web content using the latest Microsoft Edge browser and web technology. + +## Summary + +Members|Description +--|-- +[BrowserProcessId](#browserprocessid) | Gets the process ID of the browser process that hosts the WebView. +[CanGoBack](#cangoback) | `true` if the WebView is able to navigate to a previous page in the navigation history. +[CanGoForward](#cangoforward) | `true` if the WebView is able to navigate to a next page in the navigation history. +[ContainsFullScreenElement](#containsfullscreenelement) | Indicates if the WebView contains a fullscreen HTML element. +[CookieManager](#cookiemanager) | Gets the [CoreWebView2CookieManager](corewebview2cookiemanager.md) object associated with this CoreWebView2. +[DocumentTitle](#documenttitle) | Gets the title for the current top-level document. +[Environment](#environment) | Exposes the [CoreWebView2Environment](corewebview2environment.md) used to create this CoreWebView2. +[IsSuspended](#issuspended) | Whether WebView is suspended. +[Settings](#settings) | Gets the [CoreWebView2Settings](corewebview2settings.md) object contains various modifiable settings for the running WebView. +[Source](#source) | Gets the URI of the current top level document. +[AddHostObjectToScript](#addhostobjecttoscript) | Adds the provided host object to script running in the WebView with the specified name. +[AddScriptToExecuteOnDocumentCreatedAsync](#addscripttoexecuteondocumentcreatedasync) | Adds the provided JavaScript to a list of scripts that should be run after the global object has been created, but before the HTML document has been parsed and before any other script included by the HTML document is run. +[AddWebResourceRequestedFilter](#addwebresourcerequestedfilter) | Adds a URI and resource context filter for the [CoreWebView2.WebResourceRequested](corewebview2.md#webresourcerequested) event. +[CallDevToolsProtocolMethodAsync](#calldevtoolsprotocolmethodasync) | Runs an asynchronous DevToolsProtocol method. +[CapturePreviewAsync](#capturepreviewasync) | Captures an image of what WebView is displaying. +[ClearVirtualHostNameToFolderMapping](#clearvirtualhostnametofoldermapping) | Clears a host name mapping for local folder that was added by [CoreWebView2.SetVirtualHostNameToFolderMapping](corewebview2.md#setvirtualhostnametofoldermapping). +[ExecuteScriptAsync](#executescriptasync) | Runs JavaScript code from the `javaScript` parameter in the current top-level document rendered in the WebView. +[GetDevToolsProtocolEventReceiver](#getdevtoolsprotocoleventreceiver) | Gets a DevTools Protocol event receiver that allows you to subscribe to a DevToolsProtocol event. +[GoBack](#goback) | Navigates the WebView to the previous page in the navigation history. +[GoForward](#goforward) | Navigates the WebView to the next page in the navigation history. +[Navigate](#navigate) | Causes a navigation of the top level document to the specified URI. +[NavigateToString](#navigatetostring) | Initiates a navigation to `htmlContent` as source HTML of a new document. +[NavigateWithWebResourceRequest](#navigatewithwebresourcerequest) | Navigates using a constructed [CoreWebView2WebResourceRequest](corewebview2webresourcerequest.md) object. +[OpenDevToolsWindow](#opendevtoolswindow) | Opens the DevTools window for the current document in the WebView. +[OpenTaskManagerWindow](#opentaskmanagerwindow) | Opens the Browser Task Manager view as a new window in the foreground. +[PostWebMessageAsJson](#postwebmessageasjson) | Posts the specified `webMessageAsJson` to the top level document in this WebView. +[PostWebMessageAsString](#postwebmessageasstring) | Posts a message that is a simple string rather than a JSON string representation of a JavaScript object. +[PrintToPdfAsync](#printtopdfasync) | Print the current page to PDF asynchronously with the provided settings. +[Reload](#reload) | Reloads the current page. +[RemoveHostObjectFromScript](#removehostobjectfromscript) | Removes the host object specified by the name so that it is no longer accessible from JavaScript code in the WebView. +[RemoveScriptToExecuteOnDocumentCreated](#removescripttoexecuteondocumentcreated) | Removes the corresponding JavaScript added via [CoreWebView2.AddScriptToExecuteOnDocumentCreatedAsync](corewebview2.md#addscripttoexecuteondocumentcreatedasync) with the specified script ID. +[RemoveWebResourceRequestedFilter](#removewebresourcerequestedfilter) | Removes a matching WebResource filter that was previously added for the [CoreWebView2.WebResourceRequested](corewebview2.md#webresourcerequested) event. +[Resume](#resume) | Resumes the WebView so that it resumes activities on the web page. +[SetVirtualHostNameToFolderMapping](#setvirtualhostnametofoldermapping) | Sets a mapping between a virtual host name and a folder path to make available to web sites via that host name. +[Stop](#stop) | Stops all navigations and pending resource fetches. +[TrySuspendAsync](#trysuspendasync) | An app may call this API to have the WebView2 consume less memory. +[ClientCertificateRequested](#clientcertificaterequested) | ClientCertificateRequested is raised when WebView2 is making a request to an HTTP server that needs a client certificate for HTTP authentication. Read more about HTTP client certificates at [RFC 8446 The Transport Layer Security (TLS) Protocol Version 1.3](https://tools.ietf.org/html/rfc8446). +[ContainsFullScreenElementChanged](#containsfullscreenelementchanged) | ContainsFullScreenElementChanged is raised when the [CoreWebView2.ContainsFullScreenElement](corewebview2.md#containsfullscreenelement) property changes. +[ContentLoading](#contentloading) | ContentLoading is raised before any content is loaded, including scripts added with [CoreWebView2.AddScriptToExecuteOnDocumentCreatedAsync](corewebview2.md#addscripttoexecuteondocumentcreatedasync). ContentLoading is not raised if a same page navigation occurs (such as through fragment navigations or `history.pushState` navigations). +[DOMContentLoaded](#domcontentloaded) | DOMContentLoaded is raised when the initial HTML document has been parsed. +[DocumentTitleChanged](#documenttitlechanged) | DocumentTitleChanged is raised when the [CoreWebView2.DocumentTitle](corewebview2.md#documenttitle) property changes and may be raised before or after the [CoreWebView2.NavigationCompleted](corewebview2.md#navigationcompleted) event. +[DownloadStarting](#downloadstarting) | DownloadStarting is raised when a download has begun, blocking the default download dialog, but not blocking the progress of the download. +[FrameCreated](#framecreated) | FrameCreated is raised when a new iframe is created. +[FrameNavigationCompleted](#framenavigationcompleted) | FrameNavigationCompleted is raised when a child frame has completely loaded (`body.onload` has been raised) or loading stopped with error. +[FrameNavigationStarting](#framenavigationstarting) | FrameNavigationStarting is raised when a child frame in the WebView requests permission to navigate to a different URI. +[HistoryChanged](#historychanged) | HistoryChanged is raised when there is change of navigation history for the top level document. +[NavigationCompleted](#navigationcompleted) | NavigationCompleted is raised when the WebView has completely loaded (`body.onload` has been raised) or loading stopped with error. +[NavigationStarting](#navigationstarting) | NavigationStarting is raised when the WebView main frame is requesting permission to navigate to a different URI. +[NewWindowRequested](#newwindowrequested) | NewWindowRequested is raised when content inside the WebView requests to open a new window, such as through `window.open()`. +[PermissionRequested](#permissionrequested) | PermissionRequested is raised when content in a WebView requests permission to access some privileged resources. +[ProcessFailed](#processfailed) | ProcessFailed is raised when a WebView process ends unexpectedly or becomes unresponsive. +[ScriptDialogOpening](#scriptdialogopening) | ScriptDialogOpening is raised when a JavaScript dialog (`alert`, `confirm`, `prompt`, or `beforeunload`) displays for the WebView. +[SourceChanged](#sourcechanged) | SourceChanged is raised when the [CoreWebView2.Source](corewebview2.md#source) property changes. +[WebMessageReceived](#webmessagereceived) | WebMessageReceived is raised when the [CoreWebView2Settings.IsWebMessageEnabled](corewebview2settings.md#iswebmessageenabled) setting is set and the top-level document of the WebView runs `window.chrome.webview.postMessage`. +[WebResourceRequested](#webresourcerequested) | WebResourceRequested is raised when the WebView is performing a URL request to a matching URL and resource context filter that was added with [CoreWebView2.AddWebResourceRequestedFilter](corewebview2.md#addwebresourcerequestedfilter). +[WebResourceResponseReceived](#webresourceresponsereceived) | WebResourceResponseReceived is raised when the WebView receives the response for a request for a web resource (any URI resolution performed by the WebView; such as HTTP/HTTPS, file and data requests from redirects, navigations, declarations in HTML, implicit favicon lookups, and fetch API usage in the document). +[WindowCloseRequested](#windowcloserequested) | WindowCloseRequested is raised when content inside the WebView requested to close the window, such as after `window.close()` is run. + +## Properties + +### BrowserProcessId + +> readonly uint32_t BrowserProcessId + +Gets the process ID of the browser process that hosts the WebView. + +### CanGoBack + +> readonly bool CanGoBack + +`true` if the WebView is able to navigate to a previous page in the navigation history. +If CanGoBack changes value, the [CoreWebView2.HistoryChanged](corewebview2.md#historychanged) event is raised. + +### CanGoForward + +> readonly bool CanGoForward + +`true` if the WebView is able to navigate to a next page in the navigation history. +If CanGoForward changes value, the [CoreWebView2.HistoryChanged](corewebview2.md#historychanged) event is raised. + +### ContainsFullScreenElement + +> readonly bool ContainsFullScreenElement + +Indicates if the WebView contains a fullscreen HTML element. + +### CookieManager + +> readonly [CoreWebView2CookieManager](corewebview2cookiemanager.md) CookieManager + +Gets the [CoreWebView2CookieManager](corewebview2cookiemanager.md) object associated with this CoreWebView2. + +### DocumentTitle + +> readonly string DocumentTitle + +Gets the title for the current top-level document. +If the document has no explicit title or is otherwise empty, a default that may or may not match the URI of the document is used. + +### Environment + +> readonly [CoreWebView2Environment](corewebview2environment.md) Environment + +Exposes the [CoreWebView2Environment](corewebview2environment.md) used to create this CoreWebView2. + +### IsSuspended + +> readonly bool IsSuspended + +Whether WebView is suspended. +True when WebView is suspended, from the time when [CoreWebView2.TrySuspendAsync](corewebview2.md#trysuspendasync) has completed successfully until WebView is resumed. + +### Settings + +> readonly [CoreWebView2Settings](corewebview2settings.md) Settings + +Gets the [CoreWebView2Settings](corewebview2settings.md) object contains various modifiable settings for the running WebView. + +### Source + +> readonly string Source + +Gets the URI of the current top level document. +This value potentially changes as a part of the [CoreWebView2.SourceChanged](corewebview2.md#sourcechanged) event raised for some cases such as navigating to a different site or fragment navigations. It remains the same for other types of navigations such as page refreshes or `history.pushState` with the same URL as the current page. + + + +## Methods + +### AddHostObjectToScript + +> void AddHostObjectToScript(string name, Object rawObject) + +Adds the provided host object to script running in the WebView with the specified name. +Host objects are exposed as host object proxies via `window.chrome.webview.hostObjects.{name}`. Host object proxies are promises and will resolve to an object representing the host object. Only the COM visible objects/properties/methods can be accessed from script. + +JavaScript code in the WebView will be able to access appObject as following and then access attributes and methods of appObject. + +Note that while simple types, `IDispatch` and array are supported, and `IUnknown` objects that also implement `IDispatch` are treated as `IDispatch`, generic `IUnknown`, `VT_DECIMAL`, or `VT_RECORD` variant is not supported. Remote JavaScript objects like callback functions are represented as an `VT_DISPATCH` VARIANT with the object implementing `IDispatch`. The JavaScript callback method may be invoked using DISPID_VALUE for the DISPID. Nested arrays are supported up to a depth of 3. Arrays of by reference types are not supported. `VT_EMPTY` and `VT_NULL` are mapped into JavaScript as `null`. In JavaScript `null` and `undefined` are mapped to `VT_EMPTY`. + +Additionally, all host objects are exposed as `window.chrome.webview.hostObjects.sync.{name}`. Here the host objects are exposed as synchronous host object proxies. These are not promises and calls to functions or property access synchronously block running script waiting to communicate cross process for the host code to run. Accordingly this can result in reliability issues and it is recommended that you use the promise based asynchronous `window.chrome.webview.hostObjects.{name}` API described above. + +Synchronous host object proxies and asynchronous host object proxies can both proxy the same host object. Remote changes made by one proxy will be reflected in any other proxy of that same host object whether the other proxies and synchronous or asynchronous. + +While JavaScript is blocked on a synchronous call to native code, that native code is unable to call back to JavaScript. Attempts to do so will fail with `HRESULT_FROM_WIN32(ERROR_POSSIBLE_DEADLOCK)`. + +Host object proxies are JavaScript Proxy objects that intercept all property get, property set, and method invocations. Properties or methods that are a part of the Function or Object prototype are run locally. Additionally any property or method in the array `chrome.webview.hostObjects.options.forceLocalProperties` will also be run locally. This defaults to including optional methods that have meaning in JavaScript like `toJSON` and `Symbol.toPrimitive`. You can add more to this array as required. + +There's a method `chrome.webview.hostObjects.cleanupSome` that will best effort garbage collect host object proxies. + +Host object proxies additionally have the following methods which run locally: + +Method name | Details +---|--- +`applyHostFunction`, `getHostProperty`, `setHostProperty` | Perform a method invocation, property get, or property set on the host object. Use the methods to explicitly force a method or property to run remotely if a conflicting local method or property exists. For instance, `proxy.toString()` runs the local `toString` method on the proxy object. But proxy.applyHostFunction('toString') runs `toString` on the host proxied object instead. +`getLocalProperty`, `setLocalProperty` | Perform property get, or property set locally. Use the methods to force getting or setting a property on the host object proxy rather than on the host object it represents. For instance, `proxy.unknownProperty` gets the property named `unknownProperty` from the host proxied object. But proxy.getLocalProperty('unknownProperty') gets the value of the property `unknownProperty` on the proxy object. +`sync` | Asynchronous host object proxies expose a sync method which returns a promise for a synchronous host object proxy for the same host object. For example, `chrome.webview.hostObjects.sample.methodCall()` returns an asynchronous host object proxy. Use the `sync` method to obtain a synchronous host object proxy instead: `const syncProxy = await chrome.webview.hostObjects.sample.methodCall().sync()`. +`async` | Synchronous host object proxies expose an async method which blocks and returns an asynchronous host object proxy for the same host object. For example, `chrome.webview.hostObjects.sync.sample.methodCall()` returns a synchronous host object proxy. Running the `async` method on this blocks and then returns an asynchronous host object proxy for the same host object: `const asyncProxy = chrome.webview.hostObjects.sync.sample.methodCall().async()`. +`then` | Asynchronous host object proxies have a `then` method. Allows proxies to be awaitable. `then` returns a promise that resolves with a representation of the host object. If the proxy represents a JavaScript literal, a copy of that is returned locally. If the proxy represents a function, a non-awaitable proxy is returned. If the proxy represents a JavaScript object with a mix of literal properties and function properties, the a copy of the object is returned with some properties as host object proxies. + +All other property and method invocations (other than the above Remote object proxy methods, `forceLocalProperties` list, and properties on Function and Object prototypes) are run remotely. Asynchronous host object proxies return a promise representing asynchronous completion of remotely invoking the method, or getting the property. The promise resolves after the remote operations complete and the promises resolve to the resulting value of the operation. Synchronous host object proxies work similarly but block JavaScript execution and wait for the remote operation to complete. + +Setting a property on an asynchronous host object proxy works slightly differently. The set returns immediately and the return value is the value that will be set. This is a requirement of the JavaScript Proxy object. If you need to asynchronously wait for the property set to complete, use the `setHostProperty` method which returns a promise as described above. Synchronous object property set property synchronously blocks until the property is set. + +Exposing host objects to script has security risk. Please follow [best practices](/microsoft-edge/webview2/concepts/security). +To create a [IDispatch](/windows/win32/api/oaidl/nn-oaidl-idispatch) implementing class in C# use the following attributes on each class you intend to expose. +```csharp +// Bridge and BridgeAnotherClass are C# classes that implement IDispatch and works with AddHostObjectToScript. +[ClassInterface(ClassInterfaceType.AutoDual)] +[ComVisible(true)] +public class BridgeAnotherClass +{ + // Sample property. + public string Prop { get; set; } = "Example"; +} + +[ClassInterface(ClassInterfaceType.AutoDual)] +[ComVisible(true)] +public class Bridge +{ + public string Func(string param) + { + return "Example: " + param; + } + + public BridgeAnotherClass AnotherObject { get; set; } = new BridgeAnotherClass(); + + // Sample indexed property. + [System.Runtime.CompilerServices.IndexerName("Items")] + public string this[int index] + { + get { return m_dictionary[index]; } + set { m_dictionary[index] = value; } + } + private Dictionary<int, string> m_dictionary = new Dictionary<int, string>(); +} +``` +Then add instances of those classes via [CoreWebView2.AddHostObjectToScript](corewebview2.md#addhostobjecttoscript): +```csharp +webView.CoreWebView2.AddHostObjectToScript("bridge", new Bridge()); +``` +And then in script you can call the methods, and access those properties of the objects added via [CoreWebView2.AddHostObjectToScript](corewebview2.md#addhostobjecttoscript): +```csharp +// Find added objects on the hostObjects property +const bridge = chrome.webview.hostObjects.bridge; + +// Call a method and pass in a parameter. +// The result is another proxy promise so you must await to get the result. +console.log(await bridge.Func("testing...")); + +// A property may be another object as long as its class also implements +// IDispatch. +// Getting a property also gets a proxy promise you must await. +const propValue = await bridge.AnotherObject.Prop; +console.log(propValue); + +// Indexed properties +let index = 123; +bridge[index] = "test"; +let result = await bridge[index]; +console.log(result); +``` + + + +### AddScriptToExecuteOnDocumentCreatedAsync + +> [`IAsyncOperation`](/uwp/api/Windows.Foundation.IAsyncOperation-1)<string> AddScriptToExecuteOnDocumentCreatedAsync(string javaScript) + +Adds the provided JavaScript to a list of scripts that should be run after the global object has been created, but before the HTML document has been parsed and before any other script included by the HTML document is run. +The injected script will apply to all future top level document and child frame navigations until removed with [CoreWebView2.RemoveScriptToExecuteOnDocumentCreated](corewebview2.md#removescripttoexecuteondocumentcreated). +This is applied asynchronously and you must wait for the returned IAsyncOperation to complete before you can be sure that the script is ready to execute on future navigations. + +Note that if an HTML document has sandboxing of some kind via [sandbox](https://developer.mozilla.org/docs/Web/HTML/Element/iframe#attr-sandbox) properties or the [Content-Security-Policy HTTP header](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy) this will affect the script run here. So, for example, if the `allow-modals` keyword is not set then calls to the `alert` function will be ignored. + + + +### AddWebResourceRequestedFilter + +> void AddWebResourceRequestedFilter(string uri, [CoreWebView2WebResourceContext](corewebview2webresourcecontext.md) ResourceContext) + +Adds a URI and resource context filter for the [CoreWebView2.WebResourceRequested](corewebview2.md#webresourcerequested) event. +A web resource request with a resource context that matches this filter's resource context and a URI that matches this filter's URI wildcard string will be raised via the [CoreWebView2.WebResourceRequested](corewebview2.md#webresourcerequested) event. + +The `uri` parameter value is a wildcard string matched against the URI of the web resource request. This is a glob style wildcard string in which a `*` matches zero or more characters and a `?` matches exactly one character. +These wildcard characters can be escaped using a backslash just before the wildcard character in order to represent the literal `*` or `?`. + +The matching occurs over the URI as a whole string and not limiting wildcard matches to particular parts of the URI. +The wildcard filter is compared to the URI after the URI has been normalized, any URI fragment has been removed, and non-ASCII hostnames have been converted to punycode. + +Specifying a `nullptr` for the uri is equivalent to an empty string which matches no URIs. + +For more information about resource context filters, navigate to [CoreWebView2WebResourceContext](corewebview2webresourcecontext.md). + +| URI Filter String | Request URI | Match | Notes | +| ---- | ---- | ---- | ---- | +| `*` | https://contoso.com/a/b/c | Yes | A single * will match all URIs | +| `*://contoso.com/*` | https://contoso.com/a/b/c | Yes | Matches everything in contoso.com across all schemes | +| `*://contoso.com/*` | https://example.com/?https://contoso.com/ | Yes | But also matches a URI with just the same text anywhere in the URI | +| `example` | https://contoso.com/example | No | The filter does not perform partial matches | +| `*example` | https://contoso.com/example | Yes | The filter matches across URI parts | +| `*example` | https://contoso.com/path/?example | Yes | The filter matches across URI parts | +| `*example` | https://contoso.com/path/?query#example | No | The filter is matched against the URI with no fragment | +| `*example` | https://example | No | The URI is normalized before filter matching so the actual URI used for comparison is https://example.com/ | +| `*example/` | https://example | Yes | Just like above, but this time the filter ends with a / just like the normalized URI | +| https://xn--qei.example/ | https://❤.example/ | Yes | Non-ASCII hostnames are normalized to punycode before wildcard comparison | +| https://❤.example/ | https://xn--qei.example/ | No | Non-ASCII hostnames are normalized to punycode before wildcard comparison | + + + +### CallDevToolsProtocolMethodAsync + +> [`IAsyncOperation`](/uwp/api/Windows.Foundation.IAsyncOperation-1)<string> CallDevToolsProtocolMethodAsync(string methodName, string parametersAsJson) + +Runs an asynchronous DevToolsProtocol method. +For more information about available methods, navigate to [DevTools Protocol Viewer](https://aka.ms/DevToolsProtocolDocs). The handler's Invoke method will be called when the method asynchronously completes. Invoke will be called with the method's return object as a JSON string. + + + +### CapturePreviewAsync + +> [IAsyncAction](/uwp/api/Windows.Foundation.IAsyncAction) CapturePreviewAsync([CoreWebView2CapturePreviewImageFormat](corewebview2capturepreviewimageformat.md) imageFormat, [IRandomAccessStream](/uwp/api/Windows.Storage.Streams.IRandomAccessStream) imageStream) + +Captures an image of what WebView is displaying. +When CapturePreviewAsync finishes writing to the stream, the Invoke method on the provided handler parameter is called. This method fails if called before the first ContentLoading event. For example if this is called in the [CoreWebView2.NavigationStarting](corewebview2.md#navigationstarting) event for the first navigation it will fail. For subsequent navigations, the method may not fail, but will not capture an image of a given webpage until the [CoreWebView2.ContentLoading](corewebview2.md#contentloading) event has been fired for it. Any call to this method prior to that will result in a capture of the page being navigated away from. + + + +### ClearVirtualHostNameToFolderMapping + +> void ClearVirtualHostNameToFolderMapping(string hostName) + +Clears a host name mapping for local folder that was added by [CoreWebView2.SetVirtualHostNameToFolderMapping](corewebview2.md#setvirtualhostnametofoldermapping). + + + +### ExecuteScriptAsync + +> [`IAsyncOperation`](/uwp/api/Windows.Foundation.IAsyncOperation-1)<string> ExecuteScriptAsync(string javaScript) + +Runs JavaScript code from the `javaScript` parameter in the current top-level document rendered in the WebView. +If the result is `undefined`, contains a reference cycle, or otherwise is not able to be encoded into JSON, the JSON `null` value is returned as the `"null"` string. + +A function that has no explicit return value returns `undefined`. If the script that was run throws an unhandled exception, then the result is also `null`. This method is applied asynchronously. If the method is run after the [CoreWebView2.NavigationStarting](corewebview2.md#navigationstarting) event during a navigation, the script runs in the new document when loading it, around the time [CoreWebView2.ContentLoading](corewebview2.md#contentloading) is run. This operation works even if [CoreWebView2Settings.IsScriptEnabled](corewebview2settings.md#isscriptenabled) is set to `false`. + + + +### GetDevToolsProtocolEventReceiver + +> [CoreWebView2DevToolsProtocolEventReceiver](corewebview2devtoolsprotocoleventreceiver.md) GetDevToolsProtocolEventReceiver(string eventName) + +Gets a DevTools Protocol event receiver that allows you to subscribe to a DevToolsProtocol event. +For more information about DevToolsProtocol events description and event args, navigate to [DevTools Protocol Viewer](https://aka.ms/DevToolsProtocolDocs). + + + +### GoBack + +> void GoBack() + +Navigates the WebView to the previous page in the navigation history. + + + +### GoForward + +> void GoForward() + +Navigates the WebView to the next page in the navigation history. + + + +### Navigate + +> void Navigate(string uri) + +Causes a navigation of the top level document to the specified URI. +For more information, navigate to [Navigation event](/microsoft-edge/webview2/concepts/navigation-events). Note that this operation starts a navigation and the corresponding [CoreWebView2.NavigationStarting](corewebview2.md#navigationstarting) event is raised sometime after Navigate runs. + + + +### NavigateToString + +> void NavigateToString(string htmlContent) + +Initiates a navigation to `htmlContent` as source HTML of a new document. +The `htmlContent` parameter may not be larger than 2 MB (2 * 1024 * 1024 bytes) in total size. The origin of the new page is `about:blank`. + + + +### NavigateWithWebResourceRequest + +> void NavigateWithWebResourceRequest([CoreWebView2WebResourceRequest](corewebview2webresourcerequest.md) Request) + +Navigates using a constructed [CoreWebView2WebResourceRequest](corewebview2webresourcerequest.md) object. +The headers in the [CoreWebView2WebResourceRequest](corewebview2webresourcerequest.md) override headers added by WebView2 runtime except for Cookie headers. Method can only be either `GET` or `POST`. Provided post data will only be sent only if the method is `POST` and the uri scheme is `HTTP(S)`. + + + +### OpenDevToolsWindow + +> void OpenDevToolsWindow() + +Opens the DevTools window for the current document in the WebView. +Does nothing if run when the DevTools window is already open. + + + +### OpenTaskManagerWindow + +> void OpenTaskManagerWindow() + +Opens the Browser Task Manager view as a new window in the foreground. +If the Browser Task Manager is already open, this will bring it into the foreground. WebView2 currently blocks the Shift+Esc shortcut for opening the task manager. An end user can open the browser task manager manually via the `Browser task manager` entry of the DevTools window's title bar's context menu. + + + +### PostWebMessageAsJson + +> void PostWebMessageAsJson(string webMessageAsJson) + +Posts the specified `webMessageAsJson` to the top level document in this WebView. +The event args is an instance of `MessageEvent`. The [CoreWebView2Settings.IsWebMessageEnabled](corewebview2settings.md#iswebmessageenabled) setting must be `true` or this method will fail with E_INVALIDARG. The event arg's `data` property of the event arg is the `webMessageAsJson` string parameter parsed as a JSON string into a JavaScript object. The event arg's `source` property of the event arg is a reference to the `window.chrome.webview` object. For information about sending messages from the HTML document in the WebView to the host, navigate to [CoreWebView2.WebMessageReceived](corewebview2.md#webmessagereceived). The message is sent asynchronously. If a navigation occurs before the message is posted to the page, the message is not be sent. +Runs the message event of the `window.chrome.webview` of the top-level document. JavaScript in that document may subscribe and unsubscribe to the event using the following code: +```javascript +window.chrome.webview.addEventListener('message', handler) +window.chrome.webview.removeEventListener('message', handler) +``` + + + +### PostWebMessageAsString + +> void PostWebMessageAsString(string webMessageAsString) + +Posts a message that is a simple string rather than a JSON string representation of a JavaScript object. +This behaves in exactly the same manner as [CoreWebView2.PostWebMessageAsJson](corewebview2.md#postwebmessageasjson), but the `data` property of the event arg of the `window.chrome.webview` message is a string with the same value as `webMessageAsString`. Use this instead of [CoreWebView2.PostWebMessageAsJson](corewebview2.md#postwebmessageasjson) if you want to communicate using simple strings rather than JSON objects. + + + +### PrintToPdfAsync + +> [`IAsyncOperation`](/uwp/api/Windows.Foundation.IAsyncOperation-1)<bool> PrintToPdfAsync(string ResultFilePath, [CoreWebView2PrintSettings](corewebview2printsettings.md) printSettings) + +Print the current page to PDF asynchronously with the provided settings. +See [CoreWebView2PrintSettings](corewebview2printsettings.md) for description of settings. Passing null for `printSettings` results in default print settings used. + +Use `resultFilePath` to specify the path to the PDF file. The host should provide an absolute path, including file name. If the path points to an existing file, the file will be overwritten. If the path is not valid, the method fails. + +The async PrintToPdf operation completes when the data has been written to the PDF file. If the application exits before printing is complete, the file is not saved. Only one PrintToPdf operation can be in progress at a time. +If PrintToPdf is called while a print to PDF operation is in progress, the IAsyncOperation completes and returns false. + + + +### Reload + +> void Reload() + +Reloads the current page. +This is similar to navigating to the URI of current top level document including all navigation events firing and respecting any entries in the HTTP cache. But, the back or forward history will not be modified. + + + +### RemoveHostObjectFromScript + +> void RemoveHostObjectFromScript(string name) + +Removes the host object specified by the name so that it is no longer accessible from JavaScript code in the WebView. +While new access attempts are denied, if the object is already obtained by JavaScript code in the WebView, the JavaScript code continues to have access to that object. Running this method for a name that is already removed or never added fails. + + + +### RemoveScriptToExecuteOnDocumentCreated + +> void RemoveScriptToExecuteOnDocumentCreated(string id) + +Removes the corresponding JavaScript added via [CoreWebView2.AddScriptToExecuteOnDocumentCreatedAsync](corewebview2.md#addscripttoexecuteondocumentcreatedasync) with the specified script ID. + + + +### RemoveWebResourceRequestedFilter + +> void RemoveWebResourceRequestedFilter(string uri, [CoreWebView2WebResourceContext](corewebview2webresourcecontext.md) ResourceContext) + +Removes a matching WebResource filter that was previously added for the [CoreWebView2.WebResourceRequested](corewebview2.md#webresourcerequested) event. +If the same filter was added multiple times, then it must need to be removed as many times as it was added for the removal to be effective. + + + +### Resume + +> void Resume() + +Resumes the WebView so that it resumes activities on the web page. +This API can be called while the WebView2 controller is invisible. + +The app can interact with the WebView immediately after [CoreWebView2.Resume](corewebview2.md#resume). + +WebView will be automatically resumed when it becomes visible. + + + +### SetVirtualHostNameToFolderMapping + +> void SetVirtualHostNameToFolderMapping(string hostName, string folderPath, [CoreWebView2HostResourceAccessKind](corewebview2hostresourceaccesskind.md) accessKind) + +Sets a mapping between a virtual host name and a folder path to make available to web sites via that host name. +After setting the mapping, documents loaded in the WebView can use HTTP or HTTPS URLs at the specified host name specified by `hostName` to access files in the local folder specified by `folderPath`. +This mapping applies to both top-level document and iframe navigations as well as subresource references from a document. This also applies to dedicated and shared worker scripts but does not apply to service worker scripts. + +Due to a current implementation limitation, media files accessed using virtual host name can be very slow to load. + +As the resource loaders for the current page might have already been created and running, changes to the mapping might not be applied to the current page and a reload of the page is needed to apply the new mapping. + +Both absolute and relative paths are supported for `folderPath`. Relative paths are interpreted as relative to the folder where the exe of the app is in. +For example, after calling `SetVirtualHostNameToFolderMapping("appassets.example", "assets", CoreWebView2HostResourceAccessKind.Deny);`, navigating to `https://appassets.example/my-local-file.html` will show content from my-local-file.html in the assets subfolder located on disk under the same path as the app's executable file. +You should typically choose virtual host names that are never used by real sites. +If you own a domain such as `example.com`, another option is to use a subdomain reserved for the app (like `my-app.example.com`). +[RFC 6761](https://tools.ietf.org/html/rfc6761) has reserved several special-use domain names that are guaranteed to not be used by real sites (for example, `.example`, `.test`, and `.invalid`). +Apps should use distinct domain names when mapping folder from different sources that should be isolated from each other. For instance, the app might use app-file.example for files that ship as part of the app, and book1.example might be used for files containing books from a less trusted source that were previously downloaded and saved to the disk by the app. +The host name used in the APIs is canonicalized using Chromium's host name parsing logic before being used internally. +All host names that are canonicalized to the same string are considered identical. +For example, `EXAMPLE.COM` and `example.com` are treated as the same host name. +An international host name and its Punycode-encoded host name are considered the same host name. There is no DNS resolution for host name and the trailing '.' is not normalized as part of canonicalization. +Therefore `example.com` and `example.com.` are treated as different host names. Similarly, `virtual-host-name` and `virtual-host-name.example.com` are treated as different host names even if the machine has a DNS suffix of `example.com`. +Specify the minimal cross-origin access necessary to run the app. If there is not a need to access local resources from other origins, use [CoreWebView2HostResourceAccessKind](corewebview2hostresourceaccesskind.md).Deny. +```csharp +webView.CoreWebView2.SetVirtualHostNameToFolderMapping( + "appassets.example", "assets", CoreWebView2HostResourceAccessKind.DenyCors); +webView.Source = new Uri("https://appassets.example/index.html"); +``` + + + +### Stop + +> void Stop() + +Stops all navigations and pending resource fetches. +Does not stop scripts. + + + +### TrySuspendAsync + +> [`IAsyncOperation`](/uwp/api/Windows.Foundation.IAsyncOperation-1)<bool> TrySuspendAsync() + +An app may call this API to have the WebView2 consume less memory. +This is useful when a Win32 app becomes invisible, or when a Universal Windows Platform app is being suspended, during the suspended event handler before completing the suspended event. + +The [CoreWebView2Controller.IsVisible](corewebview2controller.md#isvisible) property must be false when the API is called. Otherwise, the API throws COMException with error code of `HRESULT_FROM_WIN32(ERROR_INVALID_STATE)`. + +Suspending is similar to putting a tab to sleep in the Edge browser. Suspending pauses WebView script timers and animations, minimizes CPU usage for the associated browser renderer process and allows the operating system to reuse the memory that was used by the renderer process for other processes. + +Note that Suspend is best effort and considered completed successfully once the request is sent to browser renderer process. If there is a running script, the script will continue to run and the renderer process will be suspended after that script is done. + +See [Sleeping Tabs FAQ](https://techcommunity.microsoft.com/t5/articles/sleeping-tabs-faq/m-p/1705434) for conditions that might prevent WebView from being suspended. In those situations, the result of the async task is false. + +The WebView will be automatically resumed when it becomes visible. Therefore, the app normally does not have to call [CoreWebView2.Resume](corewebview2.md#resume) explicitly. + +The app can call [CoreWebView2.Resume](corewebview2.md#resume) and then [CoreWebView2.TrySuspendAsync](corewebview2.md#trysuspendasync) periodically for an invisible WebView so that the invisible WebView can sync up with latest data and the page ready to show fresh content when it becomes visible. + +All WebView APIs can still be accessed when a WebView is suspended. Some APIs like Navigate will auto resume the WebView. To avoid unexpected auto resume, check [CoreWebView2.IsSuspended](corewebview2.md#issuspended) property before calling APIs that might change WebView state. + + + + +## Events + +### ClientCertificateRequested + +ClientCertificateRequested is raised when WebView2 is making a request to an HTTP server that needs a client certificate for HTTP authentication. Read more about HTTP client certificates at [RFC 8446 The Transport Layer Security (TLS) Protocol Version 1.3](https://tools.ietf.org/html/rfc8446). +The host have several options for responding to client certificate requests: + +Scenario | Handled | Cancel | SelectedCertificate +---------------------------------------------------------- | ------- | ------ | ------------------- +Respond to server with a certificate | True | False | MutuallyTrustedCertificate value +Respond to server without certificate | True | False | null +Display default client certificate selection dialog prompt | False | False | n/a +Cancel the request | n/a | True | n/a + +If the host don't handle the event, WebView2 will show the default client certificate selection dialog prompt to the user. + +Type: [TypedEventHandler](/uwp/api/Windows.Foundation.TypedEventHandler-2)<CoreWebView2, [CoreWebView2ClientCertificateRequestedEventArgs](corewebview2clientcertificaterequestedeventargs.md)> + +### ContainsFullScreenElementChanged + +ContainsFullScreenElementChanged is raised when the [CoreWebView2.ContainsFullScreenElement](corewebview2.md#containsfullscreenelement) property changes. +An HTML element inside the WebView may enter fullscreen to the size of the WebView or leave fullscreen. This event is useful when, for example, a video element requests to go fullscreen. The listener of this event may resize the WebView in response. + +Type: [TypedEventHandler](/uwp/api/Windows.Foundation.TypedEventHandler-2)<CoreWebView2, Object> + +### ContentLoading + +ContentLoading is raised before any content is loaded, including scripts added with [CoreWebView2.AddScriptToExecuteOnDocumentCreatedAsync](corewebview2.md#addscripttoexecuteondocumentcreatedasync). ContentLoading is not raised if a same page navigation occurs (such as through fragment navigations or `history.pushState` navigations). +This operation follows the [CoreWebView2.NavigationStarting](corewebview2.md#navigationstarting) and [CoreWebView2.SourceChanged](corewebview2.md#sourcechanged) events and precedes the [CoreWebView2.HistoryChanged](corewebview2.md#historychanged) and [CoreWebView2.NavigationCompleted](corewebview2.md#navigationcompleted) events. + +Type: [TypedEventHandler](/uwp/api/Windows.Foundation.TypedEventHandler-2)<CoreWebView2, [CoreWebView2ContentLoadingEventArgs](corewebview2contentloadingeventargs.md)> + +### DOMContentLoaded + +DOMContentLoaded is raised when the initial HTML document has been parsed. +This aligns with the the document's DOMContentLoaded event in HTML. + +Type: [TypedEventHandler](/uwp/api/Windows.Foundation.TypedEventHandler-2)<CoreWebView2, [CoreWebView2DOMContentLoadedEventArgs](corewebview2domcontentloadedeventargs.md)> + +### DocumentTitleChanged + +DocumentTitleChanged is raised when the [CoreWebView2.DocumentTitle](corewebview2.md#documenttitle) property changes and may be raised before or after the [CoreWebView2.NavigationCompleted](corewebview2.md#navigationcompleted) event. + +Type: [TypedEventHandler](/uwp/api/Windows.Foundation.TypedEventHandler-2)<CoreWebView2, Object> + +### DownloadStarting + +DownloadStarting is raised when a download has begun, blocking the default download dialog, but not blocking the progress of the download. +The host can choose to cancel a download, change the result file path, and hide the default download dialog. If download is not handled or canceled, the download is saved to the default path after the event completes with default download dialog shown. + +Type: [TypedEventHandler](/uwp/api/Windows.Foundation.TypedEventHandler-2)<CoreWebView2, [CoreWebView2DownloadStartingEventArgs](corewebview2downloadstartingeventargs.md)> + +### FrameCreated + +FrameCreated is raised when a new iframe is created. +Use the [CoreWebView2Frame.Destroyed](corewebview2frame.md#destroyed) to listen for when this iframe goes away. + +Type: [TypedEventHandler](/uwp/api/Windows.Foundation.TypedEventHandler-2)<CoreWebView2, [CoreWebView2FrameCreatedEventArgs](corewebview2framecreatedeventargs.md)> + +### FrameNavigationCompleted + +FrameNavigationCompleted is raised when a child frame has completely loaded (`body.onload` has been raised) or loading stopped with error. + +Type: [TypedEventHandler](/uwp/api/Windows.Foundation.TypedEventHandler-2)<CoreWebView2, [CoreWebView2NavigationCompletedEventArgs](corewebview2navigationcompletedeventargs.md)> + +### FrameNavigationStarting + +FrameNavigationStarting is raised when a child frame in the WebView requests permission to navigate to a different URI. +Redirects raise this operation as well, and the navigation id is the same as the original one. You may block corresponding navigations until the event handler returns. + +Type: [TypedEventHandler](/uwp/api/Windows.Foundation.TypedEventHandler-2)<CoreWebView2, [CoreWebView2NavigationStartingEventArgs](corewebview2navigationstartingeventargs.md)> + +### HistoryChanged + +HistoryChanged is raised when there is change of navigation history for the top level document. +Use HistoryChanged to verify that the [CoreWebView2.CanGoBack](corewebview2.md#cangoback) or [CoreWebView2.CanGoForward](corewebview2.md#cangoforward) value has changed. HistoryChanged is also raised for using [CoreWebView2.GoBack](corewebview2.md#goback) or [CoreWebView2.GoForward](corewebview2.md#goforward). HistoryChanged is raised after [CoreWebView2.SourceChanged](corewebview2.md#sourcechanged) and [CoreWebView2.ContentLoading](corewebview2.md#contentloading). + +Type: [TypedEventHandler](/uwp/api/Windows.Foundation.TypedEventHandler-2)<CoreWebView2, Object> + +### NavigationCompleted + +NavigationCompleted is raised when the WebView has completely loaded (`body.onload` has been raised) or loading stopped with error. + +Type: [TypedEventHandler](/uwp/api/Windows.Foundation.TypedEventHandler-2)<CoreWebView2, [CoreWebView2NavigationCompletedEventArgs](corewebview2navigationcompletedeventargs.md)> + +### NavigationStarting + +NavigationStarting is raised when the WebView main frame is requesting permission to navigate to a different URI. +Redirects raise this event as well, and the navigation id is the same as the original one. You may block corresponding navigations until the event handler returns. + +Type: [TypedEventHandler](/uwp/api/Windows.Foundation.TypedEventHandler-2)<CoreWebView2, [CoreWebView2NavigationStartingEventArgs](corewebview2navigationstartingeventargs.md)> + +### NewWindowRequested + +NewWindowRequested is raised when content inside the WebView requests to open a new window, such as through `window.open()`. +The app passes a target WebView that is considered the opened window. +If a deferral is not taken on the event args, scripts that resulted in the new window that are requested are blocked until the event handler returns. If a deferral is taken, then scripts are blocked until the deferral is completed. + +Type: [TypedEventHandler](/uwp/api/Windows.Foundation.TypedEventHandler-2)<CoreWebView2, [CoreWebView2NewWindowRequestedEventArgs](corewebview2newwindowrequestedeventargs.md)> + +### PermissionRequested + +PermissionRequested is raised when content in a WebView requests permission to access some privileged resources. +If a deferral is not taken on the event args, the subsequent scripts are blocked until the event handler returns. If a deferral is taken, the scripts are blocked until the deferral is completed. + +Type: [TypedEventHandler](/uwp/api/Windows.Foundation.TypedEventHandler-2)<CoreWebView2, [CoreWebView2PermissionRequestedEventArgs](corewebview2permissionrequestedeventargs.md)> + +### ProcessFailed + +ProcessFailed is raised when a WebView process ends unexpectedly or becomes unresponsive. + +Type: [TypedEventHandler](/uwp/api/Windows.Foundation.TypedEventHandler-2)<CoreWebView2, [CoreWebView2ProcessFailedEventArgs](corewebview2processfailedeventargs.md)> + +### ScriptDialogOpening + +ScriptDialogOpening is raised when a JavaScript dialog (`alert`, `confirm`, `prompt`, or `beforeunload`) displays for the WebView. +This event only is raised if the [CoreWebView2Settings.AreDefaultScriptDialogsEnabled](corewebview2settings.md#aredefaultscriptdialogsenabled) property is set to `false`. This event suppresses dialogs or replaces default dialogs with custom dialogs. + +If a deferral is not taken on the event args, the subsequent scripts are blocked until the event handler returns. If a deferral is taken, the scripts are blocked until the deferral is completed. + +Type: [TypedEventHandler](/uwp/api/Windows.Foundation.TypedEventHandler-2)<CoreWebView2, [CoreWebView2ScriptDialogOpeningEventArgs](corewebview2scriptdialogopeningeventargs.md)> + +### SourceChanged + +SourceChanged is raised when the [CoreWebView2.Source](corewebview2.md#source) property changes. +SourceChanged is raised when navigating to a different site or fragment navigations. It is not raised for other types of navigations such as page refreshes or `history.pushState` with the same URL as the current page. This event is raised before [CoreWebView2.ContentLoading](corewebview2.md#contentloading) for navigation to a new document. + +Type: [TypedEventHandler](/uwp/api/Windows.Foundation.TypedEventHandler-2)<CoreWebView2, [CoreWebView2SourceChangedEventArgs](corewebview2sourcechangedeventargs.md)> + +### WebMessageReceived + +WebMessageReceived is raised when the [CoreWebView2Settings.IsWebMessageEnabled](corewebview2settings.md#iswebmessageenabled) setting is set and the top-level document of the WebView runs `window.chrome.webview.postMessage`. +The `postMessage` function is `void postMessage(object)` where object is any object supported by JSON conversion. +When `postMessage` is called, the handler's Invoke method will be called with the `object` parameter `postMessage` converted to a JSON string. + +Type: [TypedEventHandler](/uwp/api/Windows.Foundation.TypedEventHandler-2)<CoreWebView2, [CoreWebView2WebMessageReceivedEventArgs](corewebview2webmessagereceivedeventargs.md)> + +### WebResourceRequested + +WebResourceRequested is raised when the WebView is performing a URL request to a matching URL and resource context filter that was added with [CoreWebView2.AddWebResourceRequestedFilter](corewebview2.md#addwebresourcerequestedfilter). +At least one filter must be added for the event to be raised. +The web resource requested may be blocked until the event handler returns if a deferral is not taken on the event args. If a deferral is taken, then the web resource requested is blocked until the deferral is completed. +Currently this only supports file, http, and https URI schemes. + +Type: [TypedEventHandler](/uwp/api/Windows.Foundation.TypedEventHandler-2)<CoreWebView2, [CoreWebView2WebResourceRequestedEventArgs](corewebview2webresourcerequestedeventargs.md)> + +### WebResourceResponseReceived + +WebResourceResponseReceived is raised when the WebView receives the response for a request for a web resource (any URI resolution performed by the WebView; such as HTTP/HTTPS, file and data requests from redirects, navigations, declarations in HTML, implicit favicon lookups, and fetch API usage in the document). +The host app can use this event to view the actual request and response for a web resource. There is no guarantee about the order in which the WebView processes the response and the host app's handler runs. The app's handler will not block the WebView from processing the response. +The event args include the [CoreWebView2WebResourceRequest](corewebview2webresourcerequest.md) as sent by the wire and [CoreWebView2WebResourceResponse](corewebview2webresourceresponse.md) received, including any additional headers added by the network stack that were not be included as part of the associated [CoreWebView2.WebResourceRequested](corewebview2.md#webresourcerequested) event, such as Authentication headers. + +Type: [TypedEventHandler](/uwp/api/Windows.Foundation.TypedEventHandler-2)<CoreWebView2, [CoreWebView2WebResourceResponseReceivedEventArgs](corewebview2webresourceresponsereceivedeventargs.md)> + +### WindowCloseRequested + +WindowCloseRequested is raised when content inside the WebView requested to close the window, such as after `window.close()` is run. +The app should close the WebView and related app window if that makes sense to the app. + +Type: [TypedEventHandler](/uwp/api/Windows.Foundation.TypedEventHandler-2)<CoreWebView2, Object> + + + +## Referenced by + +- [CoreWebView2Controller](corewebview2controller.md) +- [CoreWebView2DevToolsProtocolEventReceiver](corewebview2devtoolsprotocoleventreceiver.md) +- [CoreWebView2NewWindowRequestedEventArgs](corewebview2newwindowrequestedeventargs.md) diff --git a/1-0-1020-30/winrt/corewebview2acceleratorkeypressedeventargs.md b/1-0-1020-30/winrt/corewebview2acceleratorkeypressedeventargs.md new file mode 100644 index 00000000..e914b662 --- /dev/null +++ b/1-0-1020-30/winrt/corewebview2acceleratorkeypressedeventargs.md @@ -0,0 +1,66 @@ +--- +description: Event args for the CoreWebView2Controller.AcceleratorKeyPressed event. +title: CoreWebView2AcceleratorKeyPressedEventArgs +ms.date: 10/28/2021 +keywords: webview2, webview, winrt, win32, edge, CoreWebView2, CoreWebView2Controller, browser control, edge html, CoreWebView2AcceleratorKeyPressedEventArgs +--- + +# CoreWebView2AcceleratorKeyPressedEventArgs Class + + + +Event args for the [CoreWebView2Controller.AcceleratorKeyPressed](corewebview2controller.md#acceleratorkeypressed) event. + +## Summary + +Members|Description +--|-- +[Handled](#handled) | Indicates whether the [CoreWebView2Controller.AcceleratorKeyPressed](corewebview2controller.md#acceleratorkeypressed) event is handled by host. +[KeyEventKind](#keyeventkind) | Gets the key event kind that caused the event to run. +[KeyEventLParam](#keyeventlparam) | Gets the LPARAM value that accompanied the window message. +[PhysicalKeyStatus](#physicalkeystatus) | Gets a [CoreWebView2PhysicalKeyStatus](corewebview2physicalkeystatus.md) representing the information passed in the LPARAM of the window message. +[VirtualKey](#virtualkey) | Gets the Win32 virtual key code of the key that was pressed or released. + +## Properties + +### Handled + +> bool Handled + +Indicates whether the [CoreWebView2Controller.AcceleratorKeyPressed](corewebview2controller.md#acceleratorkeypressed) event is handled by host. +If set to `true` then this prevents the WebView from performing the default action for this accelerator key. Otherwise the WebView will perform the default action for the accelerator key. + +### KeyEventKind + +> readonly [CoreWebView2KeyEventKind](corewebview2keyeventkind.md) KeyEventKind + +Gets the key event kind that caused the event to run. + +### KeyEventLParam + +> readonly int KeyEventLParam + +Gets the LPARAM value that accompanied the window message. +See the documentation for the `WM_KEYDOWN` and `WM_KEYUP` messages. + +### PhysicalKeyStatus + +> readonly [CoreWebView2PhysicalKeyStatus](corewebview2physicalkeystatus.md) PhysicalKeyStatus + +Gets a [CoreWebView2PhysicalKeyStatus](corewebview2physicalkeystatus.md) representing the information passed in the LPARAM of the window message. + +### VirtualKey + +> readonly uint32_t VirtualKey + +Gets the Win32 virtual key code of the key that was pressed or released. +It is one of the Win32 virtual key constants such as VK_RETURN or an (uppercase) ASCII value such as 'A'. Verify whether Ctrl or Alt are pressed by running GetKeyState(VK_CONTROL) or GetKeyState(VK_MENU). + + + + + + +## Referenced by + +- [CoreWebView2Controller](corewebview2controller.md) diff --git a/1-0-1020-30/winrt/corewebview2boundsmode.md b/1-0-1020-30/winrt/corewebview2boundsmode.md new file mode 100644 index 00000000..b1d89e73 --- /dev/null +++ b/1-0-1020-30/winrt/corewebview2boundsmode.md @@ -0,0 +1,20 @@ +--- +description: Mode for how the CoreWebView2Controller.Bounds property is interpreted in relation to the CoreWebView2Controller.RasterizationScale property. +title: CoreWebView2BoundsMode +ms.date: 10/28/2021 +keywords: webview2, webview, winrt, win32, edge, CoreWebView2, CoreWebView2Controller, browser control, edge html, CoreWebView2BoundsMode +--- + +# CoreWebView2BoundsMode Enum + +Mode for how the [CoreWebView2Controller.Bounds](corewebview2controller.md#bounds) property is interpreted in relation to the [CoreWebView2Controller.RasterizationScale](corewebview2controller.md#rasterizationscale) property. + +| Name | Value | Description | +|--|--|--| +|`UseRawPixels` | 0x0 | [CoreWebView2Controller.Bounds](corewebview2controller.md#bounds) property represents raw pixels. Physical size of WebView is not impacted by [CoreWebView2Controller.RasterizationScale](corewebview2controller.md#rasterizationscale).| +|`UseRasterizationScale` | 0x1 | [CoreWebView2Controller.Bounds](corewebview2controller.md#bounds) property represents logical pixels and the [CoreWebView2Controller.RasterizationScale](corewebview2controller.md#rasterizationscale) property is used to get the physical size of the WebView.| + + +## Referenced by + +- [CoreWebView2Controller](corewebview2controller.md) diff --git a/1-0-1020-30/winrt/corewebview2browserprocessexitedeventargs.md b/1-0-1020-30/winrt/corewebview2browserprocessexitedeventargs.md new file mode 100644 index 00000000..164c14a4 --- /dev/null +++ b/1-0-1020-30/winrt/corewebview2browserprocessexitedeventargs.md @@ -0,0 +1,42 @@ +--- +description: Event args for the CoreWebView2Environment.BrowserProcessExited event. +title: CoreWebView2BrowserProcessExitedEventArgs +ms.date: 10/28/2021 +keywords: webview2, webview, winrt, win32, edge, CoreWebView2, CoreWebView2Controller, browser control, edge html, CoreWebView2BrowserProcessExitedEventArgs +--- + +# CoreWebView2BrowserProcessExitedEventArgs Class + + + +Event args for the [CoreWebView2Environment.BrowserProcessExited](corewebview2environment.md#browserprocessexited) event. + +## Summary + +Members|Description +--|-- +[BrowserProcessExitKind](#browserprocessexitkind) | The kind of browser process exit that has occurred. +[BrowserProcessId](#browserprocessid) | The process ID of the browser process that has exited. + +## Properties + +### BrowserProcessExitKind + +> readonly [CoreWebView2BrowserProcessExitKind](corewebview2browserprocessexitkind.md) BrowserProcessExitKind + +The kind of browser process exit that has occurred. + +### BrowserProcessId + +> readonly uint32_t BrowserProcessId + +The process ID of the browser process that has exited. + + + + + + +## Referenced by + +- [CoreWebView2Environment](corewebview2environment.md) diff --git a/1-0-1020-30/winrt/corewebview2browserprocessexitkind.md b/1-0-1020-30/winrt/corewebview2browserprocessexitkind.md new file mode 100644 index 00000000..5b57f56c --- /dev/null +++ b/1-0-1020-30/winrt/corewebview2browserprocessexitkind.md @@ -0,0 +1,20 @@ +--- +description: Specifies the browser process exit kind used in CoreWebView2BrowserProcessExitedEventArgs. +title: CoreWebView2BrowserProcessExitKind +ms.date: 10/28/2021 +keywords: webview2, webview, winrt, win32, edge, CoreWebView2, CoreWebView2Controller, browser control, edge html, CoreWebView2BrowserProcessExitKind +--- + +# CoreWebView2BrowserProcessExitKind Enum + +Specifies the browser process exit kind used in [CoreWebView2BrowserProcessExitedEventArgs](corewebview2browserprocessexitedeventargs.md). + +| Name | Value | Description | +|--|--|--| +|`Normal` | 0x0 | Indicates that the browser process ended normally.| +|`Failed` | 0x1 | Indicates that the browser process ended unexpectedly. A [CoreWebView2.ProcessFailed](corewebview2.md#processfailed) event will also be raised to listening WebViews from the [CoreWebView2Environment](corewebview2environment.md) associated to the failed process.| + + +## Referenced by + +- [CoreWebView2BrowserProcessExitedEventArgs](corewebview2browserprocessexitedeventargs.md) diff --git a/1-0-1020-30/winrt/corewebview2capturepreviewimageformat.md b/1-0-1020-30/winrt/corewebview2capturepreviewimageformat.md new file mode 100644 index 00000000..fc893d0c --- /dev/null +++ b/1-0-1020-30/winrt/corewebview2capturepreviewimageformat.md @@ -0,0 +1,20 @@ +--- +description: Specifies the image format for the CoreWebView2.CapturePreviewAsync method. +title: CoreWebView2CapturePreviewImageFormat +ms.date: 10/28/2021 +keywords: webview2, webview, winrt, win32, edge, CoreWebView2, CoreWebView2Controller, browser control, edge html, CoreWebView2CapturePreviewImageFormat +--- + +# CoreWebView2CapturePreviewImageFormat Enum + +Specifies the image format for the [CoreWebView2.CapturePreviewAsync](corewebview2.md#capturepreviewasync) method. + +| Name | Value | Description | +|--|--|--| +|`Png` | 0x0 | Indicates that the PNG image format is used.| +|`Jpeg` | 0x1 | Indicates that the JPEG image format is used.| + + +## Referenced by + +- [CoreWebView2](corewebview2.md) diff --git a/1-0-1020-30/winrt/corewebview2clientcertificate.md b/1-0-1020-30/winrt/corewebview2clientcertificate.md new file mode 100644 index 00000000..7fdbc1da --- /dev/null +++ b/1-0-1020-30/winrt/corewebview2clientcertificate.md @@ -0,0 +1,104 @@ +--- +description: Represents a client certificate. Gives access to a certificate's metadata. +title: CoreWebView2ClientCertificate +ms.date: 10/28/2021 +keywords: webview2, webview, winrt, win32, edge, CoreWebView2, CoreWebView2Controller, browser control, edge html, CoreWebView2ClientCertificate +--- + +# CoreWebView2ClientCertificate Class + + + +Represents a client certificate. Gives access to a certificate's metadata. + +## Summary + +Members|Description +--|-- +[DerEncodedSerialNumber](#derencodedserialnumber) | DER encoded serial number of the certificate. Read more about DER at [RFC 7468 DER](https://tools.ietf.org/html/rfc7468#appendix-B). +[DisplayName](#displayname) | Display name for a certificate. +[Issuer](#issuer) | Name of the certificate authority that issued the certificate. +[Kind](#kind) | Kind of a certificate. See [CoreWebView2ClientCertificateKind](corewebview2clientcertificatekind.md) for descriptions. +[PemEncodedIssuerCertificateChain](#pemencodedissuercertificatechain) | Returns list of PEM encoded client certificate issuer chain. In this list first element is the current certificate followed by intermediate1, intermediate2...intermediateN-1. Root certificate is the last element in the list. +[Subject](#subject) | Subject of the certificate. +[ValidFrom](#validfrom) | The valid start date and time for the certificate as the number of seconds since the UNIX epoch. +[ValidTo](#validto) | The valid expiration date and time for the certificate as the number of seconds since the UNIX epoch. +[ToCertificate](#tocertificate) | Converts this to a [Certificate](/uwp/api/Windows.Security.Cryptography.Certificates.Certificate). +[ToPemEncoding](#topemencoding) | PEM encoded data for the certificate. Returns Base64 encoding of DER encoded certificate. Read more about PEM at [RFC 1421 Privacy Enhanced Mail](https://tools.ietf.org/html/rfc1421). + +## Properties + +### DerEncodedSerialNumber + +> readonly string DerEncodedSerialNumber + +DER encoded serial number of the certificate. Read more about DER at [RFC 7468 DER](https://tools.ietf.org/html/rfc7468#appendix-B). + +### DisplayName + +> readonly string DisplayName + +Display name for a certificate. + +### Issuer + +> readonly string Issuer + +Name of the certificate authority that issued the certificate. + +### Kind + +> readonly [CoreWebView2ClientCertificateKind](corewebview2clientcertificatekind.md) Kind + +Kind of a certificate. See [CoreWebView2ClientCertificateKind](corewebview2clientcertificatekind.md) for descriptions. + +### PemEncodedIssuerCertificateChain + +> readonly [`IVectorView`](/uwp/api/Windows.Foundation.Collections.IVectorView-1)<string> PemEncodedIssuerCertificateChain + +Returns list of PEM encoded client certificate issuer chain. In this list first element is the current certificate followed by intermediate1, intermediate2...intermediateN-1. Root certificate is the last element in the list. + +### Subject + +> readonly string Subject + +Subject of the certificate. + +### ValidFrom + +> readonly double ValidFrom + +The valid start date and time for the certificate as the number of seconds since the UNIX epoch. + +### ValidTo + +> readonly double ValidTo + +The valid expiration date and time for the certificate as the number of seconds since the UNIX epoch. + + + +## Methods + +### ToCertificate + +> [Certificate](/uwp/api/Windows.Security.Cryptography.Certificates.Certificate) ToCertificate() + +Converts this to a [Certificate](/uwp/api/Windows.Security.Cryptography.Certificates.Certificate). + + + +### ToPemEncoding + +> string ToPemEncoding() + +PEM encoded data for the certificate. Returns Base64 encoding of DER encoded certificate. Read more about PEM at [RFC 1421 Privacy Enhanced Mail](https://tools.ietf.org/html/rfc1421). + + + + + + +## Referenced by + +- [CoreWebView2ClientCertificateRequestedEventArgs](corewebview2clientcertificaterequestedeventargs.md) diff --git a/1-0-1020-30/winrt/corewebview2clientcertificatekind.md b/1-0-1020-30/winrt/corewebview2clientcertificatekind.md new file mode 100644 index 00000000..6ead464b --- /dev/null +++ b/1-0-1020-30/winrt/corewebview2clientcertificatekind.md @@ -0,0 +1,21 @@ +--- +description: The kind of the CoreWebView2ClientCertificate. +title: CoreWebView2ClientCertificateKind +ms.date: 10/28/2021 +keywords: webview2, webview, winrt, win32, edge, CoreWebView2, CoreWebView2Controller, browser control, edge html, CoreWebView2ClientCertificateKind +--- + +# CoreWebView2ClientCertificateKind Enum + +The kind of the [CoreWebView2ClientCertificate](corewebview2clientcertificate.md). + +| Name | Value | Description | +|--|--|--| +|`SmartCard` | 0x0 | Specifies smart card certificate.| +|`Pin` | 0x1 | Specifies PIN certificate.| +|`Other` | 0x2 | Specifies other certificate.| + + +## Referenced by + +- [CoreWebView2ClientCertificate](corewebview2clientcertificate.md) diff --git a/1-0-1020-30/winrt/corewebview2clientcertificaterequestedeventargs.md b/1-0-1020-30/winrt/corewebview2clientcertificaterequestedeventargs.md new file mode 100644 index 00000000..9eedafe3 --- /dev/null +++ b/1-0-1020-30/winrt/corewebview2clientcertificaterequestedeventargs.md @@ -0,0 +1,103 @@ +--- +description: Event args for the CoreWebView2.ClientCertificateRequested event. +title: CoreWebView2ClientCertificateRequestedEventArgs +ms.date: 10/28/2021 +keywords: webview2, webview, winrt, win32, edge, CoreWebView2, CoreWebView2Controller, browser control, edge html, CoreWebView2ClientCertificateRequestedEventArgs +--- + +# CoreWebView2ClientCertificateRequestedEventArgs Class + + + +Event args for the [CoreWebView2.ClientCertificateRequested](corewebview2.md#clientcertificaterequested) event. + +## Summary + +Members|Description +--|-- +[AllowedCertificateAuthorities](#allowedcertificateauthorities) | The list contains distinguished names of certificate authorities allowed by the server. +[Cancel](#cancel) | Indicates whether to cancel the certificate selection. +[Handled](#handled) | Indicates whether the event has been handled by host. +[Host](#host) | Returns host name of the server that requested client certificate authentication. +[IsProxy](#isproxy) | Returns true if the server that issued this request is an http proxy. Returns false if the server is the origin server. +[MutuallyTrustedCertificates](#mutuallytrustedcertificates) | Returns the list of [CoreWebView2ClientCertificate](corewebview2clientcertificate.md) when client certificate authentication is requested. The list contains mutually trusted CA certificate. +[Port](#port) | Returns port of the server that requested client certificate authentication. +[SelectedCertificate](#selectedcertificate) | Selected certificate to respond to the server. +[GetDeferral](#getdeferral) | Gets a Deferral object. + +## Properties + +### AllowedCertificateAuthorities + +> readonly [`IVectorView`](/uwp/api/Windows.Foundation.Collections.IVectorView-1)<string> AllowedCertificateAuthorities + +The list contains distinguished names of certificate authorities allowed by the server. + +### Cancel + +> bool Cancel + +Indicates whether to cancel the certificate selection. +If canceled, the request is aborted regardless of the [CoreWebView2ClientCertificateRequestedEventArgs.Handled](corewebview2clientcertificaterequestedeventargs.md#handled) property. By default the value is false. + +### Handled + +> bool Handled + +Indicates whether the event has been handled by host. +Set to true to respond to the server with or without a certificate. If this flag is true with a [CoreWebView2ClientCertificateRequestedEventArgs.SelectedCertificate](corewebview2clientcertificaterequestedeventargs.md#selectedcertificate) it responds to the server with the selected certificate otherwise respond to the server without a certificate. By default the value of [CoreWebView2ClientCertificateRequestedEventArgs.Handled](corewebview2clientcertificaterequestedeventargs.md#handled) and [CoreWebView2ClientCertificateRequestedEventArgs.Cancel](corewebview2clientcertificaterequestedeventargs.md#cancel) are false and display default client certificate selection dialog prompt to allow the user to choose a certificate. The [CoreWebView2ClientCertificateRequestedEventArgs.SelectedCertificate](corewebview2clientcertificaterequestedeventargs.md#selectedcertificate) is ignored unless [CoreWebView2ClientCertificateRequestedEventArgs.Handled](corewebview2clientcertificaterequestedeventargs.md#handled) is set to true. + +### Host + +> readonly string Host + +Returns host name of the server that requested client certificate authentication. +Normalization rules applied to the hostname are: + +- Convert to lowercase characters for ascii characters. +- Punycode is used for representing non ascii characters. +- Strip square brackets for IPV6 address. + +### IsProxy + +> readonly bool IsProxy + +Returns true if the server that issued this request is an http proxy. Returns false if the server is the origin server. + +### MutuallyTrustedCertificates + +> readonly [`IVectorView`](/uwp/api/Windows.Foundation.Collections.IVectorView-1)<[CoreWebView2ClientCertificate](corewebview2clientcertificate.md)> MutuallyTrustedCertificates + +Returns the list of [CoreWebView2ClientCertificate](corewebview2clientcertificate.md) when client certificate authentication is requested. The list contains mutually trusted CA certificate. + +### Port + +> readonly int Port + +Returns port of the server that requested client certificate authentication. + +### SelectedCertificate + +> [CoreWebView2ClientCertificate](corewebview2clientcertificate.md) SelectedCertificate + +Selected certificate to respond to the server. + + + +## Methods + +### GetDeferral + +> [Deferral](/uwp/api/Windows.Foundation.Deferral) GetDeferral() + +Gets a Deferral object. +Use this to Complete the event at a later time. + + + + + + +## Referenced by + +- [CoreWebView2](corewebview2.md) diff --git a/1-0-1020-30/winrt/corewebview2compositioncontroller.md b/1-0-1020-30/winrt/corewebview2compositioncontroller.md new file mode 100644 index 00000000..0a0418ac --- /dev/null +++ b/1-0-1020-30/winrt/corewebview2compositioncontroller.md @@ -0,0 +1,75 @@ +--- +description: This class is an extension of the CoreWebView2Controller class to support visual hosting. +title: CoreWebView2CompositionController +ms.date: 10/28/2021 +keywords: webview2, webview, winrt, win32, edge, CoreWebView2, CoreWebView2Controller, browser control, edge html, CoreWebView2CompositionController +--- + +# CoreWebView2CompositionController Class + +Extends: [CoreWebView2Controller](corewebview2controller.md) + + + +This class is an extension of the [CoreWebView2Controller](corewebview2controller.md) class to support visual hosting. + +## Summary + +Members|Description +--|-- +[Cursor](#cursor) | The current cursor that WebView thinks it should be. +[RootVisualTarget](#rootvisualtarget) | Gets or sets the root visual in the hosting app's visual tree. +[SendMouseInput](#sendmouseinput) | Sends mouse input to the WebView. +[SendPointerInput](#sendpointerinput) | Sends pen or pointer input to the WebView. +[CursorChanged](#cursorchanged) | The event is raised when WebView thinks the cursor should be changed. + +## Properties + +### Cursor + +> readonly [CoreCursor](/uwp/api/Windows.UI.Core.CoreCursor) Cursor + +The current cursor that WebView thinks it should be. + +### RootVisualTarget + +> Object RootVisualTarget + +Gets or sets the root visual in the hosting app's visual tree. +This visual is where the WebView will connect its visual tree. The app uses this visual to position the WebView within the app. The app still needs to use the [CoreWebView2Controller.Bounds](corewebview2controller.md#bounds) property to size the WebView. The RootVisualTarget property can be an IDCompositionVisual or a Windows::UI::Composition::ContainerVisual. WebView will connect its visual tree to the provided visual before returning from the property setter. The app needs to commit on its device setting the RootVisualTarget property. The RootVisualTarget property supports being set to `null` to disconnect the WebView from the app's visual tree. + + + +## Methods + +### SendMouseInput + +> void SendMouseInput([CoreWebView2MouseEventKind](corewebview2mouseeventkind.md) eventKind, [CoreWebView2MouseEventVirtualKeys](corewebview2mouseeventvirtualkeys.md) virtualKeys, uint32_t mouseData, [Point](/uwp/api/Windows.Foundation.Point) point) + +Sends mouse input to the WebView. +If `eventKind` is [CoreWebView2MouseEventKind](corewebview2mouseeventkind.md).HorizontalWheel or [CoreWebView2MouseEventKind](corewebview2mouseeventkind.md).Wheel, then `mouseData` specifies the amount of wheel movement. +A positive value indicates that the wheel was rotated forward, away from the user; a negative value indicates that the wheel was rotated backward, toward the user. One wheel click is defined as WHEEL_DELTA, which is 120. If `eventKind` is [CoreWebView2MouseEventKind](corewebview2mouseeventkind.md).XButtonDoubleClick, [CoreWebView2MouseEventKind](corewebview2mouseeventkind.md).XButtonDown, or [CoreWebView2MouseEventKind](corewebview2mouseeventkind.md).XButtonUp, then `mouseData` specifies which X buttons were pressed or released. This value should be 1 if the first X button is pressed/released and 2 if the second X button is pressed/released. If `eventKind` is [CoreWebView2MouseEventKind](corewebview2mouseeventkind.md).Leave, then `virtualKeys`, `mouseData`, and point should all be zero. If `eventKind` is any other value, then `mouseData` should be zero. `point` is expected to be in the client coordinate space of the WebView. To track mouse events that start in the WebView and can potentially move outside of the WebView and host application, calling SetCapture and ReleaseCapture is recommended. To dismiss hover popups, it is also recommended to send [CoreWebView2MouseEventKind](corewebview2mouseeventkind.md).Leave messages. + + + +### SendPointerInput + +> void SendPointerInput([CoreWebView2PointerEventKind](corewebview2pointereventkind.md) eventKind, [CoreWebView2PointerInfo](corewebview2pointerinfo.md) pointerInfo) + +Sends pen or pointer input to the WebView. +Accepts touch or pen pointer input of kinds defined in [CoreWebView2PointerEventKind](corewebview2pointereventkind.md). +Any pointer input from the system must be converted into a [CoreWebView2PointerInfo](corewebview2pointerinfo.md) first. + + + + +## Events + +### CursorChanged + +The event is raised when WebView thinks the cursor should be changed. +For example, when the mouse cursor is currently the default cursor but is then moved over text, it may try to change to the IBeam cursor. +It is expected for the developer to send [CoreWebView2MouseEventKind](corewebview2mouseeventkind.md).Leave messages (in addition to [CoreWebView2MouseEventKind](corewebview2mouseeventkind.md).Move messages) through [CoreWebView2CompositionController.SendMouseInput](corewebview2compositioncontroller.md#sendmouseinput). This is to ensure that the mouse is actually within the WebView that sends out CursorChanged events. + +Type: [TypedEventHandler](/uwp/api/Windows.Foundation.TypedEventHandler-2)<CoreWebView2CompositionController, Object> + diff --git a/1-0-1020-30/winrt/corewebview2contentloadingeventargs.md b/1-0-1020-30/winrt/corewebview2contentloadingeventargs.md new file mode 100644 index 00000000..fd8e2aa9 --- /dev/null +++ b/1-0-1020-30/winrt/corewebview2contentloadingeventargs.md @@ -0,0 +1,42 @@ +--- +description: Event args for the CoreWebView2.ContentLoading event. +title: CoreWebView2ContentLoadingEventArgs +ms.date: 10/28/2021 +keywords: webview2, webview, winrt, win32, edge, CoreWebView2, CoreWebView2Controller, browser control, edge html, CoreWebView2ContentLoadingEventArgs +--- + +# CoreWebView2ContentLoadingEventArgs Class + + + +Event args for the [CoreWebView2.ContentLoading](corewebview2.md#contentloading) event. + +## Summary + +Members|Description +--|-- +[IsErrorPage](#iserrorpage) | `true` if the loaded content is an error page. +[NavigationId](#navigationid) | Gets the ID of the navigation. + +## Properties + +### IsErrorPage + +> readonly bool IsErrorPage + +`true` if the loaded content is an error page. + +### NavigationId + +> readonly uint64_t NavigationId + +Gets the ID of the navigation. + + + + + + +## Referenced by + +- [CoreWebView2](corewebview2.md) diff --git a/1-0-1020-30/winrt/corewebview2controller.md b/1-0-1020-30/winrt/corewebview2controller.md new file mode 100644 index 00000000..16d5e3c9 --- /dev/null +++ b/1-0-1020-30/winrt/corewebview2controller.md @@ -0,0 +1,210 @@ +--- +description: The owner of the CoreWebView2 object that provides support for resizing, showing and hiding, focusing, and other functionality related to windowing and composition. +title: CoreWebView2Controller +ms.date: 10/28/2021 +keywords: webview2, webview, winrt, win32, edge, CoreWebView2, CoreWebView2Controller, browser control, edge html, CoreWebView2Controller +--- + +# CoreWebView2Controller Class + + + +The owner of the [CoreWebView2](corewebview2.md) object that provides support for resizing, showing and hiding, focusing, and other functionality related to windowing and composition. +The CoreWebView2Controller owns the [CoreWebView2](corewebview2.md), and if all references to the CoreWebView2Controller go away, the WebView is closed. + +## Summary + +Members|Description +--|-- +[Bounds](#bounds) | Gets or sets the WebView bounds. +[BoundsMode](#boundsmode) | Gets or sets the WebView bounds mode. +[CoreWebView2](#corewebview2) | Gets the [CoreWebView2](corewebview2.md) associated with this CoreWebView2Controller. +[DefaultBackgroundColor](#defaultbackgroundcolor) | Gets or sets the WebView default background color. +[IsVisible](#isvisible) | Determines whether to show or hide the WebView. +[ParentWindow](#parentwindow) | Gets the parent window provided by the app or sets the parent window that this WebView is using to render content. +[RasterizationScale](#rasterizationscale) | Gets or sets the WebView rasterization scale. +[ShouldDetectMonitorScaleChanges](#shoulddetectmonitorscalechanges) | Determines whether the WebView will detect monitor scale changes. +[ZoomFactor](#zoomfactor) | Gets or sets the zoom factor for the WebView. +[Close](#close) | Closes the WebView and cleans up the underlying browser instance. +[MoveFocus](#movefocus) | Moves focus into WebView. +[NotifyParentWindowPositionChanged](#notifyparentwindowpositionchanged) | Tells WebView that the main WebView parent (or any ancestor) HWND moved. +[SetBoundsAndZoomFactor](#setboundsandzoomfactor) | Updates [CoreWebView2Controller.Bounds](corewebview2controller.md#bounds) and [CoreWebView2Controller.ZoomFactor](corewebview2controller.md#zoomfactor) properties at the same time. +[AcceleratorKeyPressed](#acceleratorkeypressed) | AcceleratorKeyPressed is raised when an accelerator key or key combo is pressed or released while the WebView is focused. +[GotFocus](#gotfocus) | GotFocus is raised when WebView gets focus. +[LostFocus](#lostfocus) | LostFocus is raised when WebView loses focus. +[MoveFocusRequested](#movefocusrequested) | MoveFocusRequested is raised when user tries to tab out of the WebView. +[RasterizationScaleChanged](#rasterizationscalechanged) | RasterizationScaleChanged is raised when the [CoreWebView2Controller.RasterizationScale](corewebview2controller.md#rasterizationscale) property changes. +[ZoomFactorChanged](#zoomfactorchanged) | ZoomFactorChanged is raised when the [CoreWebView2Controller.ZoomFactor](corewebview2controller.md#zoomfactor) property changes. + +## Properties + +### Bounds + +> [Rect](/uwp/api/Windows.Foundation.Rect) Bounds + +Gets or sets the WebView bounds. +Bounds are relative to the [CoreWebView2Controller.ParentWindow](corewebview2controller.md#parentwindow). The app has two ways to position a WebView: + +- Create a child HWND that is the WebView parent HWND. Position the window where the WebView should be. Use (0, 0) for the top-left corner (the offset) of the Bounds of the WebView. +- Use the top-most window of the app as the WebView parent HWND. For example, to position ebView correctly in the app, set the top-left corner of the Bounds of the WebView. + +The values of Bounds are limited by the coordinate space of the host. + +### BoundsMode + +> [CoreWebView2BoundsMode](corewebview2boundsmode.md) BoundsMode + +Gets or sets the WebView bounds mode. +BoundsMode affects how setting the [CoreWebView2Controller.Bounds](corewebview2controller.md#bounds) and [CoreWebView2Controller.RasterizationScale](corewebview2controller.md#rasterizationscale) properties work. Bounds mode can either be in [CoreWebView2BoundsMode](corewebview2boundsmode.md).UseRawPixels mode or [CoreWebView2BoundsMode](corewebview2boundsmode.md).UseRasterizationScale mode. + +### CoreWebView2 + +> readonly [CoreWebView2](corewebview2.md) CoreWebView2 + +Gets the [CoreWebView2](corewebview2.md) associated with this CoreWebView2Controller. + +### DefaultBackgroundColor + +> [Color](/uwp/api/Windows.UI.Color) DefaultBackgroundColor + +Gets or sets the WebView default background color. +The DefaultBackgroundColor is the color that renders underneath all web content. This means WebView renders this color when there is no web content loaded such as before the initial navigation or between navigations. This also means web pages with undefined css background properties or background properties containing transparent pixels will render their contents over this color. Web pages with defined and opaque background properties that span the page will obscure the DefaultBackgroundColor and display normally. The default value for this property is white to resemble the native browser experience. Currently this API only supports opaque colors and transparency. It will fail for colors with alpha values that don't equal 0 or 255 ie. translucent colors are not supported. It also does not support transparency on Windows 7. On Windows 7, setting DefaultBackgroundColor to a Color with an Alpha value other than 255 will result in failure. On any OS above Win7, choosing a transparent color will result in showing hosting app content. This means webpages without explicit background properties defined will render web content over hosting app content. + +### IsVisible + +> bool IsVisible + +Determines whether to show or hide the WebView. +If `IsVisible` is set to `false`, the WebView is transparent and is not rendered. However, this does not affect the window containing the WebView (the `ParentWindow` parameter that was passed to [CoreWebView2Environment.CreateCoreWebView2ControllerAsync](corewebview2environment.md#createcorewebview2controllerasync)). +WebView as a child window does not get window messages when the top window is minimized or restored. For performance reasons, developers should set the `IsVisible` property of the WebView to `false` when the app window is minimized and back to `true` when the app window is restored. The app window does this by handling `SIZE_MINIMIZED and SIZE_RESTORED` command upon receiving `WM_SIZE` message. There are CPU and memory benefits when the page is hidden. For instance Chromium has code that throttles activities on the page like animations and some tasks are run less frequently. Similarly, WebView2 will purge some caches to reduce memory usage. + +### ParentWindow + +> [CoreWebView2ControllerWindowReference](corewebview2controllerwindowreference.md) ParentWindow + +Gets the parent window provided by the app or sets the parent window that this WebView is using to render content. +It initially returns the `ParentWindow` passed into [CoreWebView2Environment.CreateCoreWebView2ControllerAsync](corewebview2environment.md#createcorewebview2controllerasync). Setting the property causes the WebView to re-parent the main WebView window to the newly provided window. + +### RasterizationScale + +> double RasterizationScale + +Gets or sets the WebView rasterization scale. +The rasterization scale is the combination of the monitor DPI scale and text scaling set by the user. This value should be updated when the DPI scale of the app's top level window changes (i.e. monitor DPI scale changes or the window changes monitor) or when the text scale factor of the system changes. +Rasterization scale applies to the WebView content, as well as popups, context menus, scroll bars, and so on. Normal app scaling scenarios should use the [CoreWebView2Controller.ZoomFactor](corewebview2controller.md#zoomfactor) property or [CoreWebView2Controller.SetBoundsAndZoomFactor](corewebview2controller.md#setboundsandzoomfactor) method. + +### ShouldDetectMonitorScaleChanges + +> bool ShouldDetectMonitorScaleChanges + +Determines whether the WebView will detect monitor scale changes. +ShouldDetectMonitorScaleChanges property determines whether the WebView attempts to track monitor DPI scale changes. When true, the WebView will track monitor DPI scale changes, update the [CoreWebView2Controller.RasterizationScale](corewebview2controller.md#rasterizationscale) property, and fire [CoreWebView2Controller.RasterizationScaleChanged](corewebview2controller.md#rasterizationscalechanged) event. When `false`, the WebView will not track monitor DPI scale changes, and the app must update the [CoreWebView2Controller.RasterizationScale](corewebview2controller.md#rasterizationscale) property itself. [CoreWebView2Controller.RasterizationScaleChanged](corewebview2controller.md#rasterizationscalechanged) event will never fire when ShouldDetectMonitorScaleChanges is false. + +### ZoomFactor + +> double ZoomFactor + +Gets or sets the zoom factor for the WebView. +Note that changing zoom factor may cause `window.innerWidth` or `window.innerHeight` and page layout to change. A zoom factor that is applied by the host by setting this ZoomFactor property becomes the new default zoom for the WebView. This zoom factor applies across navigations and is the zoom factor WebView is returned to when the user presses Ctrl+0. When the zoom factor is changed by the user (resulting in the app receiving [CoreWebView2Controller.ZoomFactorChanged](corewebview2controller.md#zoomfactorchanged)), that zoom applies only for the current page. Any user applied zoom is only for the current page and is reset on a navigation. Specifying a ZoomFactor less than or equal to 0 is not allowed. WebView also has an internal supported zoom factor range. When a specified zoom factor is out of that range, it is normalized to be within the range, and a [CoreWebView2Controller.ZoomFactorChanged](corewebview2controller.md#zoomfactorchanged) event is raised for the real applied zoom factor. When this range normalization happens, this reports the zoom factor specified during the previous modification of the ZoomFactor property until the [CoreWebView2Controller.ZoomFactorChanged](corewebview2controller.md#zoomfactorchanged) event is received after WebView applies the normalized zoom factor. + + + +## Methods + +### Close + +> void Close() + +Closes the WebView and cleans up the underlying browser instance. +Cleaning up the browser instance releases the resources powering the WebView. The browser instance is shut down if no other WebViews are using it. + +After running Close, all methods fail and event handlers stop running. Specifically, the WebView releases the associated references to any associated event handlers when Close is run. + +Close is implicitly run when the CoreWebView2Controller loses the final reference and is destructed. But it is best practice to explicitly run Close to avoid any accidental cycle of references between the WebView and the app code. Specifically, if you capture a reference to the WebView in an event handler you create a reference cycle between the WebView and the event handler. Run Close to break the cycle by releasing all event handlers. But to avoid the situation, it is best to both explicitly run Close on the WebView and to not capture a reference to the WebView to ensure the WebView is cleaned up correctly. `Close` is synchronous and won't trigger the `beforeunload` event. + + + +### MoveFocus + +> void MoveFocus([CoreWebView2MoveFocusReason](corewebview2movefocusreason.md) reason) + +Moves focus into WebView. +WebView will get focus and focus will be set to correspondent element in the page hosted in the WebView. For [CoreWebView2MoveFocusReason](corewebview2movefocusreason.md).Programmatic reason, focus is set to previously focused element or the default element if no previously focused element exists. For [CoreWebView2MoveFocusReason](corewebview2movefocusreason.md).Next reason, focus is set to the first element. For [CoreWebView2MoveFocusReason](corewebview2movefocusreason.md).Previous reason, focus is set to the last element. WebView changes focus through user interaction including selecting into a WebView or Tab into it. For tabbing, the app runs MoveFocus with [CoreWebView2MoveFocusReason](corewebview2movefocusreason.md).Next or [CoreWebView2MoveFocusReason](corewebview2movefocusreason.md).Previous to align with Tab and Shift+Tab respectively when it decides the WebView is the next tabbable element. + + + +### NotifyParentWindowPositionChanged + +> void NotifyParentWindowPositionChanged() + +Tells WebView that the main WebView parent (or any ancestor) HWND moved. +This is a notification separate from [CoreWebView2Controller.Bounds](corewebview2controller.md#bounds). This is needed for accessibility and certain dialogs in WebView to work correctly. + + + +### SetBoundsAndZoomFactor + +> void SetBoundsAndZoomFactor([Rect](/uwp/api/Windows.Foundation.Rect) Bounds, double ZoomFactor) + +Updates [CoreWebView2Controller.Bounds](corewebview2controller.md#bounds) and [CoreWebView2Controller.ZoomFactor](corewebview2controller.md#zoomfactor) properties at the same time. +This operation is atomic from the perspective of the host. After returning from this function, the [CoreWebView2Controller.Bounds](corewebview2controller.md#bounds) and [CoreWebView2Controller.ZoomFactor](corewebview2controller.md#zoomfactor) properties are both updated if the function is successful, or neither is updated if the function fails. If [CoreWebView2Controller.Bounds](corewebview2controller.md#bounds) and [CoreWebView2Controller.ZoomFactor](corewebview2controller.md#zoomfactor) are both updated by the same scale (for example, [CoreWebView2Controller.Bounds](corewebview2controller.md#bounds) and [CoreWebView2Controller.ZoomFactor](corewebview2controller.md#zoomfactor) are both doubled), then the page does not display a change in `window.innerWidth` or `window.innerHeight` and the WebView renders the content at the new size and zoom without intermediate renderings. This function also updates just one of [CoreWebView2Controller.ZoomFactor](corewebview2controller.md#zoomfactor) or [CoreWebView2Controller.Bounds](corewebview2controller.md#bounds) by passing in the new value for one and the current value for the other. + + + + +## Events + +### AcceleratorKeyPressed + +AcceleratorKeyPressed is raised when an accelerator key or key combo is pressed or released while the WebView is focused. +A key is considered an accelerator if either of the following conditions are true: + +- Ctrl or Alt is currently being held. +- The pressed key does not map to a character. + +A few specific keys are never considered accelerators, such as Shift. The Escape key is always considered an accelerator. + +Autorepeated key events caused by holding the key down will also raise this event. Filter out the auto-repeated key events by verifying [CoreWebView2AcceleratorKeyPressedEventArgs.KeyEventLParam](corewebview2acceleratorkeypressedeventargs.md#keyeventlparam) or [CoreWebView2AcceleratorKeyPressedEventArgs.PhysicalKeyStatus](corewebview2acceleratorkeypressedeventargs.md#physicalkeystatus). + +In windowed mode, this event is synchronous. Until you set [CoreWebView2AcceleratorKeyPressedEventArgs.Handled](corewebview2acceleratorkeypressedeventargs.md#handled) to `true` or the event handler returns, the browser process is blocked and outgoing cross-process COM calls will fail with RPC_E_CANTCALLOUT_ININPUTSYNCCALL. All [CoreWebView2](corewebview2.md) methods work, however. + +In windowless mode, the event is asynchronous. Further input do not reach the browser until the event handler returns or [CoreWebView2AcceleratorKeyPressedEventArgs.Handled](corewebview2acceleratorkeypressedeventargs.md#handled) is set to `true`, but the browser process is not blocked, and outgoing COM calls work normally. + +It is recommended to set [CoreWebView2AcceleratorKeyPressedEventArgs.Handled](corewebview2acceleratorkeypressedeventargs.md#handled) to `true` as early as you are able to know that you want to handle the accelerator key. + +Type: [TypedEventHandler](/uwp/api/Windows.Foundation.TypedEventHandler-2)<CoreWebView2Controller, [CoreWebView2AcceleratorKeyPressedEventArgs](corewebview2acceleratorkeypressedeventargs.md)> + +### GotFocus + +GotFocus is raised when WebView gets focus. + +Type: [TypedEventHandler](/uwp/api/Windows.Foundation.TypedEventHandler-2)<CoreWebView2Controller, Object> + +### LostFocus + +LostFocus is raised when WebView loses focus. +In the case where [CoreWebView2Controller.MoveFocusRequested](corewebview2controller.md#movefocusrequested) event is raised, the focus is still on WebView when [CoreWebView2Controller.MoveFocusRequested](corewebview2controller.md#movefocusrequested) event is raised. LostFocus is only raised afterwards when code of the app or default action of [CoreWebView2Controller.MoveFocusRequested](corewebview2controller.md#movefocusrequested) event sets focus away from WebView. + +Type: [TypedEventHandler](/uwp/api/Windows.Foundation.TypedEventHandler-2)<CoreWebView2Controller, Object> + +### MoveFocusRequested + +MoveFocusRequested is raised when user tries to tab out of the WebView. +The focus of the WebView has not changed when this event is raised. + +Type: [TypedEventHandler](/uwp/api/Windows.Foundation.TypedEventHandler-2)<CoreWebView2Controller, [CoreWebView2MoveFocusRequestedEventArgs](corewebview2movefocusrequestedeventargs.md)> + +### RasterizationScaleChanged + +RasterizationScaleChanged is raised when the [CoreWebView2Controller.RasterizationScale](corewebview2controller.md#rasterizationscale) property changes. +The event is raised when the Webview detects that the monitor DPI scale has changed, [CoreWebView2Controller.ShouldDetectMonitorScaleChanges](corewebview2controller.md#shoulddetectmonitorscalechanges) is true, and the Webview has changed the [CoreWebView2Controller.RasterizationScale](corewebview2controller.md#rasterizationscale) property. + +Type: [TypedEventHandler](/uwp/api/Windows.Foundation.TypedEventHandler-2)<CoreWebView2Controller, Object> + +### ZoomFactorChanged + +ZoomFactorChanged is raised when the [CoreWebView2Controller.ZoomFactor](corewebview2controller.md#zoomfactor) property changes. +The event may be raised because the [CoreWebView2Controller.ZoomFactor](corewebview2controller.md#zoomfactor) property was modified, or due to the user manually modifying the zoom. When it is modified using the [CoreWebView2Controller.ZoomFactor](corewebview2controller.md#zoomfactor) property, the internal zoom factor is updated immediately and no ZoomFactorChanged event is raised. WebView associates the last used zoom factor for each site. It is possible for the zoom factor to change when navigating to a different page. When the zoom factor changes due to a navigation change, the ZoomFactorChanged event is raised right after the [CoreWebView2.ContentLoading](corewebview2.md#contentloading) event. + +Type: [TypedEventHandler](/uwp/api/Windows.Foundation.TypedEventHandler-2)<CoreWebView2Controller, Object> + diff --git a/1-0-1020-30/winrt/corewebview2controllerwindowreference.md b/1-0-1020-30/winrt/corewebview2controllerwindowreference.md new file mode 100644 index 00000000..2c395d3c --- /dev/null +++ b/1-0-1020-30/winrt/corewebview2controllerwindowreference.md @@ -0,0 +1,67 @@ +--- +description: References an HWND or a CoreWindow. +title: CoreWebView2ControllerWindowReference +ms.date: 10/28/2021 +keywords: webview2, webview, winrt, win32, edge, CoreWebView2, CoreWebView2Controller, browser control, edge html, CoreWebView2ControllerWindowReference +--- + +# CoreWebView2ControllerWindowReference Class + + + +References an HWND or a CoreWindow. +This is used in [CoreWebView2Controller](corewebview2controller.md) APIs that take a window in order to support either an HWND or a CoreWindow parameter. + +## Summary + +Members|Description +--|-- +[CoreWindow](#corewindow) | The CoreWindow object of this window reference. +[WindowHandle](#windowhandle) | The HWND window handle of this window reference. +[CreateFromCoreWindow](#createfromcorewindow) | Create a CoreWebView2ControllerWindowReference from a CoreWindow. +[CreateFromWindowHandle](#createfromwindowhandle) | Create a CoreWebView2ControllerWindowReference from an HWND. + +## Properties + +### CoreWindow + +> readonly [CoreWindow](/uwp/api/Windows.UI.Core.CoreWindow) CoreWindow + +The CoreWindow object of this window reference. +This may be null. When this is non-null, the [CoreWebView2ControllerWindowReference.WindowHandle](corewebview2controllerwindowreference.md#windowhandle) property is the HWND for this CoreWindow. + +### WindowHandle + +> readonly uint64_t WindowHandle + +The HWND window handle of this window reference. + + + +## Methods + +### CreateFromCoreWindow + +> static CoreWebView2ControllerWindowReference CreateFromCoreWindow([CoreWindow](/uwp/api/Windows.UI.Core.CoreWindow) coreWindow) + +Create a CoreWebView2ControllerWindowReference from a CoreWindow. +The resulting CoreWebView2ControllerWindowReference will have its [CoreWebView2ControllerWindowReference.CoreWindow](corewebview2controllerwindowreference.md#corewindow) property set to the coreWindow parameter value and a [CoreWebView2ControllerWindowReference.WindowHandle](corewebview2controllerwindowreference.md#windowhandle) property set to the HWND of that coreWindow. + + + +### CreateFromWindowHandle + +> static CoreWebView2ControllerWindowReference CreateFromWindowHandle(uint64_t windowHandle) + +Create a CoreWebView2ControllerWindowReference from an HWND. +The resulting CoreWebView2ControllerWindowReference will have its [CoreWebView2ControllerWindowReference.WindowHandle](corewebview2controllerwindowreference.md#windowhandle) property set to the windowHandle parameter value and a null [CoreWebView2ControllerWindowReference.CoreWindow](corewebview2controllerwindowreference.md#corewindow) property. + + + + + + +## Referenced by + +- [CoreWebView2Controller](corewebview2controller.md) +- [CoreWebView2Environment](corewebview2environment.md) diff --git a/1-0-1020-30/winrt/corewebview2cookie.md b/1-0-1020-30/winrt/corewebview2cookie.md new file mode 100644 index 00000000..91cc6777 --- /dev/null +++ b/1-0-1020-30/winrt/corewebview2cookie.md @@ -0,0 +1,94 @@ +--- +description: Provides a set of properties that are used to manage a CoreWebView2Cookie. +title: CoreWebView2Cookie +ms.date: 10/28/2021 +keywords: webview2, webview, winrt, win32, edge, CoreWebView2, CoreWebView2Controller, browser control, edge html, CoreWebView2Cookie +--- + +# CoreWebView2Cookie Class + + + +Provides a set of properties that are used to manage a CoreWebView2Cookie. + +## Summary + +Members|Description +--|-- +[Domain](#domain) | Gets the domain for which the cookie is valid. +[Expires](#expires) | The expiration date and time for the cookie since the UNIX epoch. +[IsHttpOnly](#ishttponly) | Determines whether this cookie is http-only. +[IsSecure](#issecure) | Gets or sets the security level of this cookie. +[IsSession](#issession) | Determines whether this is a session cookie. The default value is `false`. +[Name](#name) | Get or sets the cookie name. +[Path](#path) | Gets the path for which the cookie is valid. +[SameSite](#samesite) | Determines the SameSite status of the cookie which represents the enforcement mode of the cookie. +[Value](#value) | Gets or sets the cookie value. + +## Properties + +### Domain + +> readonly string Domain + +Gets the domain for which the cookie is valid. +The default value is the host that this cookie has been received from. Note that, for instance, `.bing.com`, `bing.com`, and `www.bing.com` are considered different domains. + +### Expires + +> double Expires + +The expiration date and time for the cookie since the UNIX epoch. + +### IsHttpOnly + +> bool IsHttpOnly + +Determines whether this cookie is http-only. + +### IsSecure + +> bool IsSecure + +Gets or sets the security level of this cookie. + +### IsSession + +> readonly bool IsSession + +Determines whether this is a session cookie. The default value is `false`. + +### Name + +> readonly string Name + +Get or sets the cookie name. + +### Path + +> readonly string Path + +Gets the path for which the cookie is valid. +The default value is "/", which means this cookie will be sent to all pages on the [CoreWebView2Cookie.Domain](corewebview2cookie.md#domain). + +### SameSite + +> [CoreWebView2CookieSameSiteKind](corewebview2cookiesamesitekind.md) SameSite + +Determines the SameSite status of the cookie which represents the enforcement mode of the cookie. +The default value is [CoreWebView2CookieSameSiteKind](corewebview2cookiesamesitekind.md).Lax. + +### Value + +> string Value + +Gets or sets the cookie value. + + + + + + +## Referenced by + +- [CoreWebView2CookieManager](corewebview2cookiemanager.md) diff --git a/1-0-1020-30/winrt/corewebview2cookiemanager.md b/1-0-1020-30/winrt/corewebview2cookiemanager.md new file mode 100644 index 00000000..a52bc057 --- /dev/null +++ b/1-0-1020-30/winrt/corewebview2cookiemanager.md @@ -0,0 +1,95 @@ +--- +description: Creates, adds or updates, gets, or or view the cookies. +title: CoreWebView2CookieManager +ms.date: 10/28/2021 +keywords: webview2, webview, winrt, win32, edge, CoreWebView2, CoreWebView2Controller, browser control, edge html, CoreWebView2CookieManager +--- + +# CoreWebView2CookieManager Class + + + +Creates, adds or updates, gets, or or view the cookies. +The changes would apply to the context of the user profile. That is, other WebViews under the same user profile could be affected. + +## Summary + +Members|Description +--|-- +[AddOrUpdateCookie](#addorupdatecookie) | Adds or updates a cookie with the given cookie data; may overwrite cookies with matching name, domain, and path if they exist. +[CopyCookie](#copycookie) | Creates a cookie whose params matches those of the specified cookie. +[CreateCookie](#createcookie) | Creates a cookie object with a specified name, value, domain, and path. +[DeleteAllCookies](#deleteallcookies) | Deletes all cookies under the same profile. +[DeleteCookie](#deletecookie) | Deletes a cookie whose name and domain/path pair match those of the specified cookie. +[DeleteCookies](#deletecookies) | Deletes cookies with matching name and uri. +[DeleteCookiesWithDomainAndPath](#deletecookieswithdomainandpath) | Deletes cookies with matching name and domain/path pair. + + + +## Methods + +### AddOrUpdateCookie + +> void AddOrUpdateCookie([CoreWebView2Cookie](corewebview2cookie.md) cookie) + +Adds or updates a cookie with the given cookie data; may overwrite cookies with matching name, domain, and path if they exist. +This method will fail if the domain of the given cookie is not specified. + + + +### CopyCookie + +> [CoreWebView2Cookie](corewebview2cookie.md) CopyCookie([CoreWebView2Cookie](corewebview2cookie.md) cookieParam) + +Creates a cookie whose params matches those of the specified cookie. + + + +### CreateCookie + +> [CoreWebView2Cookie](corewebview2cookie.md) CreateCookie(string name, string value, string Domain, string Path) + +Creates a cookie object with a specified name, value, domain, and path. +One can set other optional properties after cookie creation. This only creates a cookie object and it is not added to the cookie manager until you call [CoreWebView2CookieManager.AddOrUpdateCookie](corewebview2cookiemanager.md#addorupdatecookie). name that starts with whitespace(s) is not allowed. + + + +### DeleteAllCookies + +> void DeleteAllCookies() + +Deletes all cookies under the same profile. +This could affect other WebViews under the same user profile. + + + +### DeleteCookie + +> void DeleteCookie([CoreWebView2Cookie](corewebview2cookie.md) cookie) + +Deletes a cookie whose name and domain/path pair match those of the specified cookie. + + + +### DeleteCookies + +> void DeleteCookies(string name, string uri) + +Deletes cookies with matching name and uri. + + + +### DeleteCookiesWithDomainAndPath + +> void DeleteCookiesWithDomainAndPath(string name, string Domain, string Path) + +Deletes cookies with matching name and domain/path pair. + + + + + + +## Referenced by + +- [CoreWebView2](corewebview2.md) diff --git a/1-0-1020-30/winrt/corewebview2cookiesamesitekind.md b/1-0-1020-30/winrt/corewebview2cookiesamesitekind.md new file mode 100644 index 00000000..8b7d0320 --- /dev/null +++ b/1-0-1020-30/winrt/corewebview2cookiesamesitekind.md @@ -0,0 +1,24 @@ +--- +description: Kind of cookie SameSite status used in the CoreWebView2Cookie class. +title: CoreWebView2CookieSameSiteKind +ms.date: 10/28/2021 +keywords: webview2, webview, winrt, win32, edge, CoreWebView2, CoreWebView2Controller, browser control, edge html, CoreWebView2CookieSameSiteKind +--- + +# CoreWebView2CookieSameSiteKind Enum + +Kind of cookie SameSite status used in the [CoreWebView2Cookie](corewebview2cookie.md) class. +These fields match those as specified in https://developer.mozilla.org/docs/Web/HTTP/Cookies#. +Learn more about SameSite cookies here: https://tools.ietf.org/html/draft-west-first-party-cookies-07 + +| Name | Value | Description | +|--|--|--| +|`None` | 0x0 | None SameSite type. No restrictions on cross-site requests.| +|`Lax` | 0x1 | Lax SameSite type. The cookie will be sent with "same-site" requests, and with "cross-site" top level navigation.| +|`Strict` | 0x2 | Strict SameSite type. The cookie will only be sent along with "same-site" requests. +| + + +## Referenced by + +- [CoreWebView2Cookie](corewebview2cookie.md) diff --git a/1-0-1020-30/winrt/corewebview2devtoolsprotocoleventreceivedeventargs.md b/1-0-1020-30/winrt/corewebview2devtoolsprotocoleventreceivedeventargs.md new file mode 100644 index 00000000..0977842a --- /dev/null +++ b/1-0-1020-30/winrt/corewebview2devtoolsprotocoleventreceivedeventargs.md @@ -0,0 +1,35 @@ +--- +description: Event args for the CoreWebView2DevToolsProtocolEventReceiver.DevToolsProtocolEventReceived event. +title: CoreWebView2DevToolsProtocolEventReceivedEventArgs +ms.date: 10/28/2021 +keywords: webview2, webview, winrt, win32, edge, CoreWebView2, CoreWebView2Controller, browser control, edge html, CoreWebView2DevToolsProtocolEventReceivedEventArgs +--- + +# CoreWebView2DevToolsProtocolEventReceivedEventArgs Class + + + +Event args for the [CoreWebView2DevToolsProtocolEventReceiver.DevToolsProtocolEventReceived](corewebview2devtoolsprotocoleventreceiver.md#devtoolsprotocoleventreceived) event. + +## Summary + +Members|Description +--|-- +[ParameterObjectAsJson](#parameterobjectasjson) | Gets the parameter object of the corresponding DevToolsProtocol event represented as a JSON string. + +## Properties + +### ParameterObjectAsJson + +> readonly string ParameterObjectAsJson + +Gets the parameter object of the corresponding DevToolsProtocol event represented as a JSON string. + + + + + + +## Referenced by + +- [CoreWebView2DevToolsProtocolEventReceiver](corewebview2devtoolsprotocoleventreceiver.md) diff --git a/1-0-1020-30/winrt/corewebview2devtoolsprotocoleventreceiver.md b/1-0-1020-30/winrt/corewebview2devtoolsprotocoleventreceiver.md new file mode 100644 index 00000000..e4fa3264 --- /dev/null +++ b/1-0-1020-30/winrt/corewebview2devtoolsprotocoleventreceiver.md @@ -0,0 +1,36 @@ +--- +description: A Receiver is created for a particular DevTools Protocol event and allows you to subscribe and unsubscribe from that event. +title: CoreWebView2DevToolsProtocolEventReceiver +ms.date: 10/28/2021 +keywords: webview2, webview, winrt, win32, edge, CoreWebView2, CoreWebView2Controller, browser control, edge html, CoreWebView2DevToolsProtocolEventReceiver +--- + +# CoreWebView2DevToolsProtocolEventReceiver Class + + + +A Receiver is created for a particular DevTools Protocol event and allows you to subscribe and unsubscribe from that event. +Obtained from the WebView object using [CoreWebView2.GetDevToolsProtocolEventReceiver](corewebview2.md#getdevtoolsprotocoleventreceiver). + +## Summary + +Members|Description +--|-- +[DevToolsProtocolEventReceived](#devtoolsprotocoleventreceived) | DevToolsProtocolEventReceived is raised when the corresponding DevToolsProtocol event is raised. + + + + +## Events + +### DevToolsProtocolEventReceived + +DevToolsProtocolEventReceived is raised when the corresponding DevToolsProtocol event is raised. + +Type: [TypedEventHandler](/uwp/api/Windows.Foundation.TypedEventHandler-2)<[CoreWebView2](corewebview2.md), [CoreWebView2DevToolsProtocolEventReceivedEventArgs](corewebview2devtoolsprotocoleventreceivedeventargs.md)> + + + +## Referenced by + +- [CoreWebView2](corewebview2.md) diff --git a/1-0-1020-30/winrt/corewebview2domcontentloadedeventargs.md b/1-0-1020-30/winrt/corewebview2domcontentloadedeventargs.md new file mode 100644 index 00000000..3f4820d7 --- /dev/null +++ b/1-0-1020-30/winrt/corewebview2domcontentloadedeventargs.md @@ -0,0 +1,35 @@ +--- +description: Event args for the CoreWebView2.DOMContentLoaded event. +title: CoreWebView2DOMContentLoadedEventArgs +ms.date: 10/28/2021 +keywords: webview2, webview, winrt, win32, edge, CoreWebView2, CoreWebView2Controller, browser control, edge html, CoreWebView2DOMContentLoadedEventArgs +--- + +# CoreWebView2DOMContentLoadedEventArgs Class + + + +Event args for the [CoreWebView2.DOMContentLoaded](corewebview2.md#domcontentloaded) event. + +## Summary + +Members|Description +--|-- +[NavigationId](#navigationid) | Gets the ID of the navigation. + +## Properties + +### NavigationId + +> readonly uint64_t NavigationId + +Gets the ID of the navigation. + + + + + + +## Referenced by + +- [CoreWebView2](corewebview2.md) diff --git a/1-0-1020-30/winrt/corewebview2downloadinterruptreason.md b/1-0-1020-30/winrt/corewebview2downloadinterruptreason.md new file mode 100644 index 00000000..01840928 --- /dev/null +++ b/1-0-1020-30/winrt/corewebview2downloadinterruptreason.md @@ -0,0 +1,48 @@ +--- +description: The reason why the CoreWebView2DownloadOperation was interrupted. +title: CoreWebView2DownloadInterruptReason +ms.date: 10/28/2021 +keywords: webview2, webview, winrt, win32, edge, CoreWebView2, CoreWebView2Controller, browser control, edge html, CoreWebView2DownloadInterruptReason +--- + +# CoreWebView2DownloadInterruptReason Enum + +The reason why the [CoreWebView2DownloadOperation](corewebview2downloadoperation.md) was interrupted. + +| Name | Value | Description | +|--|--|--| +|`None` | 0x0 | No interrupt reason.| +|`FileFailed` | 0x1 | Generic file error.| +|`FileAccessDenied` | 0x2 | Access denied due to security restrictions.| +|`FileNoSpace` | 0x3 | Disk full. User should free some space or choose a different location to store the file.| +|`FileNameTooLong` | 0x4 | Result file path with file name is too long.| +|`FileTooLarge` | 0x5 | File is too large for file system.| +|`FileMalicious` | 0x6 | Microsoft Defender Smartscreen detected a virus in the file.| +|`FileTransientError` | 0x7 | File was in use, too many files opened, or out of memory.| +|`FileBlockedByPolicy` | 0x8 | File blocked by local policy.| +|`FileSecurityCheckFailed` | 0x9 | Security check failed unexpectedly. Microsoft Defender SmartScreen could not scan this file.| +|`FileTooShort` | 0xa | Seeking past the end of a file in opening a file, as part of resuming an interrupted download. The file did not exist or was not as large as expected. Partially downloaded file was truncated or deleted, and download will be restarted automatically.| +|`FileHashMismatch` | 0xb | Partial file did not match the expected hash and was deleted. Download will be restarted automatically.| +|`NetworkFailed` | 0xc | Generic network error. User can retry the download manually.| +|`NetworkTimeout` | 0xd | Network operation timed out.| +|`NetworkDisconnected` | 0xe | Network connection lost. User can retry the download manually.| +|`NetworkServerDown` | 0xf | Server has gone down. User can retry the download manually.| +|`NetworkInvalidRequest` | 0x10 | Network request invalid because original or redirected URI is invalid, has an unsupported scheme, or is disallowed by network policy.| +|`ServerFailed` | 0x11 | Generic server error. User can retry the download manually.| +|`ServerNoRange` | 0x12 | Server does not support range requests.| +|`ServerBadContent` | 0x13 | Server does not have the requested data.| +|`ServerUnauthorized` | 0x14 | Server did not authorize access to resource.| +|`ServerCertificateProblem` | 0x15 | Server certificate problem.| +|`ServerForbidden` | 0x16 | Server access forbidden.| +|`ServerUnexpectedResponse` | 0x17 | Unexpected server response. Responding server may not be intended server. User can retry the download manually.| +|`ServerContentLengthMismatch` | 0x18 | Server sent fewer bytes than the Content-Length header. Content-Length header may be invalid or connection may have closed. Download is treated as complete unless there are [strong validators](https://tools.ietf.org/html/rfc7232#section-2) present to interrupt the download.| +|`ServerCrossOriginRedirect` | 0x19 | Unexpected cross-origin redirect.| +|`UserCanceled` | 0x1a | User canceled the download.| +|`UserShutdown` | 0x1b | User shut down the WebView. Resuming downloads that were interrupted during shutdown is not yet supported.| +|`UserPaused` | 0x1c | User paused the download.| +|`DownloadProcessCrashed` | 0x1d | WebView crashed.| + + +## Referenced by + +- [CoreWebView2DownloadOperation](corewebview2downloadoperation.md) diff --git a/1-0-1020-30/winrt/corewebview2downloadoperation.md b/1-0-1020-30/winrt/corewebview2downloadoperation.md new file mode 100644 index 00000000..e8af78ff --- /dev/null +++ b/1-0-1020-30/winrt/corewebview2downloadoperation.md @@ -0,0 +1,159 @@ +--- +description: Represents a download operation. Gives access to a download's metadata and supports a user canceling, pausing, or resuming a download. +title: CoreWebView2DownloadOperation +ms.date: 10/28/2021 +keywords: webview2, webview, winrt, win32, edge, CoreWebView2, CoreWebView2Controller, browser control, edge html, CoreWebView2DownloadOperation +--- + +# CoreWebView2DownloadOperation Class + + + +Represents a download operation. Gives access to a download's metadata and supports a user canceling, pausing, or resuming a download. + +## Summary + +Members|Description +--|-- +[BytesReceived](#bytesreceived) | The number of bytes that have been written to the download file. +[CanResume](#canresume) | Returns true if an interrupted download can be resumed. +[ContentDisposition](#contentdisposition) | The Content-Disposition header value from the download's HTTP response. If none, the value is an empty string. +[EstimatedEndTime](#estimatedendtime) | The estimated end time of the download. +[InterruptReason](#interruptreason) | The reason why connection with file host was broken. +[MimeType](#mimetype) | MIME type of the downloaded content. +[ResultFilePath](#resultfilepath) | The absolute path to the download file, including file name. +[State](#state) | The state of the download. A download can be in progress, interrupted, or completed. +[TotalBytesToReceive](#totalbytestoreceive) | The expected size of the download in total number of bytes based on the HTTP Content-Length header. +[Uri](#uri) | The URI of the download. +[Cancel](#cancel) | Cancels the download. +[Pause](#pause) | Pauses the download. +[Resume](#resume) | Resumes a paused download. May also resume a download that was interrupted for another reason if [CoreWebView2DownloadOperation.CanResume](corewebview2downloadoperation.md#canresume) returns true. +[BytesReceivedChanged](#bytesreceivedchanged) | Event raised when the bytes received count is updated. +[EstimatedEndTimeChanged](#estimatedendtimechanged) | Event raised when the estimated end time changes. +[StateChanged](#statechanged) | Event raised when the state of the download changes. + +## Properties + +### BytesReceived + +> readonly int64_t BytesReceived + +The number of bytes that have been written to the download file. + +### CanResume + +> readonly bool CanResume + +Returns true if an interrupted download can be resumed. +Downloads with the following interrupt reasons may automatically resume without you calling any methods: [CoreWebView2DownloadInterruptReason](corewebview2downloadinterruptreason.md).ServerNoRange, [CoreWebView2DownloadInterruptReason](corewebview2downloadinterruptreason.md).FileHashMismatch, [CoreWebView2DownloadInterruptReason](corewebview2downloadinterruptreason.md).FileTooShort. In these cases progress may be restarted with [CoreWebView2DownloadOperation.BytesReceived](corewebview2downloadoperation.md#bytesreceived) set to 0. + +### ContentDisposition + +> readonly string ContentDisposition + +The Content-Disposition header value from the download's HTTP response. If none, the value is an empty string. + +### EstimatedEndTime + +> readonly string EstimatedEndTime + +The estimated end time of the download. + +### InterruptReason + +> readonly [CoreWebView2DownloadInterruptReason](corewebview2downloadinterruptreason.md) InterruptReason + +The reason why connection with file host was broken. +See [CoreWebView2DownloadInterruptReason](corewebview2downloadinterruptreason.md) for descriptions of reasons. + +### MimeType + +> readonly string MimeType + +MIME type of the downloaded content. + +### ResultFilePath + +> readonly string ResultFilePath + +The absolute path to the download file, including file name. +Host can change this from [CoreWebView2DownloadStartingEventArgs.ResultFilePath](corewebview2downloadstartingeventargs.md#resultfilepath). + +### State + +> readonly [CoreWebView2DownloadState](corewebview2downloadstate.md) State + +The state of the download. A download can be in progress, interrupted, or completed. +See [CoreWebView2DownloadState](corewebview2downloadstate.md) for descriptions of states. + +### TotalBytesToReceive + +> readonly int64_t TotalBytesToReceive + +The expected size of the download in total number of bytes based on the HTTP Content-Length header. +Returns null if the size is unknown. + +### Uri + +> readonly string Uri + +The URI of the download. + + + +## Methods + +### Cancel + +> void Cancel() + +Cancels the download. +If canceled, the default download dialog shows that the download was canceled. Host should use [CoreWebView2DownloadStartingEventArgs.Cancel](corewebview2downloadstartingeventargs.md#cancel) if download should be canceled without displaying the default download dialog. + + + +### Pause + +> void Pause() + +Pauses the download. +If paused, the default download dialog shows that the download is paused. No effect if download is already paused. Pausing a download changes the state from in progress to interrupted, with interrupt reason set to [CoreWebView2DownloadInterruptReason](corewebview2downloadinterruptreason.md).UserCanceled. + + + +### Resume + +> void Resume() + +Resumes a paused download. May also resume a download that was interrupted for another reason if [CoreWebView2DownloadOperation.CanResume](corewebview2downloadoperation.md#canresume) returns true. +Resuming a download changes the state from interrupted to in progress. + + + + +## Events + +### BytesReceivedChanged + +Event raised when the bytes received count is updated. + +Type: [TypedEventHandler](/uwp/api/Windows.Foundation.TypedEventHandler-2)<CoreWebView2DownloadOperation, Object> + +### EstimatedEndTimeChanged + +Event raised when the estimated end time changes. + +Type: [TypedEventHandler](/uwp/api/Windows.Foundation.TypedEventHandler-2)<CoreWebView2DownloadOperation, Object> + +### StateChanged + +Event raised when the state of the download changes. +Use CoreWebView2DownloadOperation.State to get the current state, and CoreWebView2DownloadOperation.InterruptReason to get the reason if the download is interrupted. + +Type: [TypedEventHandler](/uwp/api/Windows.Foundation.TypedEventHandler-2)<CoreWebView2DownloadOperation, Object> + + + +## Referenced by + +- [CoreWebView2DownloadStartingEventArgs](corewebview2downloadstartingeventargs.md) diff --git a/1-0-1020-30/winrt/corewebview2downloadstartingeventargs.md b/1-0-1020-30/winrt/corewebview2downloadstartingeventargs.md new file mode 100644 index 00000000..606d1f7d --- /dev/null +++ b/1-0-1020-30/winrt/corewebview2downloadstartingeventargs.md @@ -0,0 +1,71 @@ +--- +description: Event args for the CoreWebView2.DownloadStarting event. +title: CoreWebView2DownloadStartingEventArgs +ms.date: 10/28/2021 +keywords: webview2, webview, winrt, win32, edge, CoreWebView2, CoreWebView2Controller, browser control, edge html, CoreWebView2DownloadStartingEventArgs +--- + +# CoreWebView2DownloadStartingEventArgs Class + + + +Event args for the [CoreWebView2.DownloadStarting](corewebview2.md#downloadstarting) event. + +## Summary + +Members|Description +--|-- +[Cancel](#cancel) | Indicates whether to cancel the download. +[DownloadOperation](#downloadoperation) | Returns the [CoreWebView2DownloadOperation](corewebview2downloadoperation.md) for the download that has started. +[Handled](#handled) | Indicates whether to hide the default download dialog. +[ResultFilePath](#resultfilepath) | The path to the file. +[GetDeferral](#getdeferral) | Gets a Deferral object. + +## Properties + +### Cancel + +> bool Cancel + +Indicates whether to cancel the download. +If canceled, the download save dialog is not displayed regardless of the [CoreWebView2DownloadStartingEventArgs.Handled](corewebview2downloadstartingeventargs.md#handled) value and the state is changed to [CoreWebView2DownloadState](corewebview2downloadstate.md).Interrupted with interrupt reason [CoreWebView2DownloadInterruptReason](corewebview2downloadinterruptreason.md).UserCanceled. + +### DownloadOperation + +> readonly [CoreWebView2DownloadOperation](corewebview2downloadoperation.md) DownloadOperation + +Returns the [CoreWebView2DownloadOperation](corewebview2downloadoperation.md) for the download that has started. + +### Handled + +> bool Handled + +Indicates whether to hide the default download dialog. +If set to true, the default download dialog is hidden for this download. The download progresses normally if it is not canceled, there will just be no default UI shown. By default the value is false and the default download dialog is shown. + +### ResultFilePath + +> string ResultFilePath + +The path to the file. +If setting the path, the host should ensure that it is an absolute path, including the file name, and that the path does not point to an existing file. If the path points to an existing file, the file will be overwritten. If the directory does not exist, it is created. + + + +## Methods + +### GetDeferral + +> [Deferral](/uwp/api/Windows.Foundation.Deferral) GetDeferral() + +Gets a Deferral object. +Use this to Complete the event at a later time. + + + + + + +## Referenced by + +- [CoreWebView2](corewebview2.md) diff --git a/1-0-1020-30/winrt/corewebview2downloadstate.md b/1-0-1020-30/winrt/corewebview2downloadstate.md new file mode 100644 index 00000000..1735001b --- /dev/null +++ b/1-0-1020-30/winrt/corewebview2downloadstate.md @@ -0,0 +1,21 @@ +--- +description: The state of the CoreWebView2DownloadOperation. +title: CoreWebView2DownloadState +ms.date: 10/28/2021 +keywords: webview2, webview, winrt, win32, edge, CoreWebView2, CoreWebView2Controller, browser control, edge html, CoreWebView2DownloadState +--- + +# CoreWebView2DownloadState Enum + +The state of the [CoreWebView2DownloadOperation](corewebview2downloadoperation.md). + +| Name | Value | Description | +|--|--|--| +|`InProgress` | 0x0 | The download is in progress.| +|`Interrupted` | 0x1 | The connection with the file host was broken. The reason why a download was interrupted can accessed from [CoreWebView2DownloadOperation.InterruptReason](corewebview2downloadoperation.md#interruptreason). See [CoreWebView2DownloadInterruptReason](corewebview2downloadinterruptreason.md) for descriptions of the different kinds of interrupt reasons. Host can check whether an interrupted download can be resumed with [CoreWebView2DownloadOperation.CanResume](corewebview2downloadoperation.md#canresume). Once resumed, the download state is in progress.| +|`Completed` | 0x2 | The download completed successfully.| + + +## Referenced by + +- [CoreWebView2DownloadOperation](corewebview2downloadoperation.md) diff --git a/1-0-1020-30/winrt/corewebview2environment.md b/1-0-1020-30/winrt/corewebview2environment.md new file mode 100644 index 00000000..e9d4ce7a --- /dev/null +++ b/1-0-1020-30/winrt/corewebview2environment.md @@ -0,0 +1,188 @@ +--- +description: This represents the WebView2 Environment. +title: CoreWebView2Environment +ms.date: 10/28/2021 +keywords: webview2, webview, winrt, win32, edge, CoreWebView2, CoreWebView2Controller, browser control, edge html, CoreWebView2Environment +--- + +# CoreWebView2Environment Class + + + +This represents the WebView2 Environment. +WebViews created from an environment run on the Browser process specified with environment parameters and objects created from an environment should be used in the same environment. Using it in different environments are not guaranteed to be compatible and may fail. + +## Summary + +Members|Description +--|-- +[BrowserVersionString](#browserversionstring) | Gets the browser version info of the current CoreWebView2Environment, including channel name if it is not the stable channel. +[CompareBrowserVersionString](#comparebrowserversionstring) | Compares two instances of browser versions correctly and returns an integer that indicates whether the first instance is older, the same as, or newer than the second instance. +[CreateAsync](#createasync) | Creates a WebView2 Environment using the installed or a custom WebView2 Runtime version. +[CreateCoreWebView2CompositionControllerAsync](#createcorewebview2compositioncontrollerasync) | Asynchronously creates a new WebView for use with visual hosting. +[CreateCoreWebView2ControllerAsync](#createcorewebview2controllerasync) | Asynchronously creates a new WebView. +[CreateCoreWebView2PointerInfo](#createcorewebview2pointerinfo) | Creates an empty [CoreWebView2PointerInfo](corewebview2pointerinfo.md). +[CreatePrintSettings](#createprintsettings) | Creates the [CoreWebView2PrintSettings](corewebview2printsettings.md) used by the [CoreWebView2.PrintToPdfAsync](corewebview2.md#printtopdfasync) method. +[CreateWebResourceRequest](#createwebresourcerequest) | Creates a new [CoreWebView2WebResourceRequest](corewebview2webresourcerequest.md) object. +[CreateWebResourceResponse](#createwebresourceresponse) | Creates a new [CoreWebView2WebResourceResponse](corewebview2webresourceresponse.md) object. +[CreateWithOptionsAsync](#createwithoptionsasync) | Creates a WebView2 Environment with a custom version of WebView2 Runtime, user data folder, and environment options. +[GetAvailableBrowserVersionString](#getavailablebrowserversionstring) | Gets the browser version info including channel name if it is not the stable channel or WebView2 Runtime. +[GetAvailableBrowserVersionString](#getavailablebrowserversionstring) | Gets the browser version info including channel name if it is not the stable channel or WebView2 Runtime where `browserExecutableFolder` is the relative path to the folder that contains the WebView2 Runtime. +[BrowserProcessExited](#browserprocessexited) | BrowserProcessExited is raised when the collection of WebView2 Runtime processes for the browser process of this CoreWebView2Environment terminate due to browser process failure or normal shutdown (for example, when all associated WebViews are closed), after all resources have been released (including the user data folder). +[NewBrowserVersionAvailable](#newbrowserversionavailable) | NewBrowserVersionAvailable is raised when a newer version of the WebView2 Runtime is installed and available using WebView2. + +## Properties + +### BrowserVersionString + +> readonly string BrowserVersionString + +Gets the browser version info of the current CoreWebView2Environment, including channel name if it is not the stable channel. +It matches the format of the [CoreWebView2Environment.GetAvailableBrowserVersionString](corewebview2environment.md#getavailablebrowserversionstring) method. Channel names are `beta`, `dev`, and `canary`. + + + +## Methods + +### CompareBrowserVersionString + +> static int CompareBrowserVersionString(string browserVersionString1, string browserVersionString2) + +Compares two instances of browser versions correctly and returns an integer that indicates whether the first instance is older, the same as, or newer than the second instance. +`browserVersionString1` is one of the version strings to compare. `browserVersionString2` is the other version string to compare. + + + +### CreateAsync + +> static [`IAsyncOperation`](/uwp/api/Windows.Foundation.IAsyncOperation-1)<CoreWebView2Environment> CreateAsync() + +Creates a WebView2 Environment using the installed or a custom WebView2 Runtime version. + + + +### CreateCoreWebView2CompositionControllerAsync + +> [`IAsyncOperation`](/uwp/api/Windows.Foundation.IAsyncOperation-1)<[CoreWebView2CompositionController](corewebview2compositioncontroller.md)> CreateCoreWebView2CompositionControllerAsync([CoreWebView2ControllerWindowReference](corewebview2controllerwindowreference.md) ParentWindow) + +Asynchronously creates a new WebView for use with visual hosting. +`ParentWindow` will be the HWND that the app will receive pointer/mouse input meant for the WebView (and will need to use [CoreWebView2CompositionController.SendMouseInput](corewebview2compositioncontroller.md#sendmouseinput) or [CoreWebView2CompositionController.SendPointerInput](corewebview2compositioncontroller.md#sendpointerinput) to forward). If the app moves the WebView visual tree to underneath a different window, then it needs to set [CoreWebView2Controller.ParentWindow](corewebview2controller.md#parentwindow) to update the new parent HWND of the visual tree. + +Set [CoreWebView2CompositionController.RootVisualTarget](corewebview2compositioncontroller.md#rootvisualtarget) property on the created [CoreWebView2CompositionController](corewebview2compositioncontroller.md) to provide a visual to host the browser's visual tree. + +It is recommended that the application set Application User Model ID for the process or the application window. If none is set, during WebView creation a generated Application User Model ID is set to root window of `ParentWindow`. + +CreateCoreWebView2Controller is supported in the following versions of Windows: + +- Windows 11 +- Windows 10 +- Windows Server 2019 +- Windows Server 2016 + + + + +### CreateCoreWebView2ControllerAsync + +> [`IAsyncOperation`](/uwp/api/Windows.Foundation.IAsyncOperation-1)<[CoreWebView2Controller](corewebview2controller.md)> CreateCoreWebView2ControllerAsync([CoreWebView2ControllerWindowReference](corewebview2controllerwindowreference.md) ParentWindow) + +Asynchronously creates a new WebView. +The WebView adds a child window to the provided window during WebView creation. Z-order and other things impacted by sibling window order are affected accordingly. + +It is recommended that the application set Application User Model ID for the process or the application window. If none is set, during WebView creation a generated Application User Model ID is set to root window of `ParentWindow`. + +It is recommended that the app handles restart manager messages, to gracefully restart it in the case when the app is using the WebView2 Runtime from a certain installation and that installation is being uninstalled. For example, if a user installs a version of the WebView2 Runtime and opts to use another version of the WebView2 Runtime for testing the app, and then uninstalls the 1st version of the WebView2 Runtime without closing the app, the app restarts to allow un-installation to succeed. + +When the app retries CreateCoreWebView2ControllerAsync upon failure, it is recommended that the app restarts from creating a new WebView2 Environment. If a WebView2 Runtime update happens, the version associated with a WebView2 Environment may have been removed and causing the object to no longer work. Creating a new WebView2 Environment works since it uses the latest version. + +WebView creation fails if a running instance using the same user data folder exists, and the Environment objects have different [CoreWebView2EnvironmentOptions](corewebview2environmentoptions.md). For example, if a WebView was created with one [CoreWebView2EnvironmentOptions.Language](corewebview2environmentoptions.md#language), an attempt to create a WebView with a different [CoreWebView2EnvironmentOptions.Language](corewebview2environmentoptions.md#language) using the same user data folder fails. + + + +### CreateCoreWebView2PointerInfo + +> [CoreWebView2PointerInfo](corewebview2pointerinfo.md) CreateCoreWebView2PointerInfo() + +Creates an empty [CoreWebView2PointerInfo](corewebview2pointerinfo.md). +The returned [CoreWebView2PointerInfo](corewebview2pointerinfo.md) needs to be populated with all of the relevant info before calling [CoreWebView2CompositionController.SendPointerInput](corewebview2compositioncontroller.md#sendpointerinput). + + + +### CreatePrintSettings + +> [CoreWebView2PrintSettings](corewebview2printsettings.md) CreatePrintSettings() + +Creates the [CoreWebView2PrintSettings](corewebview2printsettings.md) used by the [CoreWebView2.PrintToPdfAsync](corewebview2.md#printtopdfasync) method. + + + +### CreateWebResourceRequest + +> [CoreWebView2WebResourceRequest](corewebview2webresourcerequest.md) CreateWebResourceRequest(string uri, string Method, [IRandomAccessStream](/uwp/api/Windows.Storage.Streams.IRandomAccessStream) postData, string Headers) + +Creates a new [CoreWebView2WebResourceRequest](corewebview2webresourcerequest.md) object. +`uri` parameter must be absolute URI. It's also possible to create this object with `null` headers string and then use the [CoreWebView2HttpRequestHeaders](corewebview2httprequestheaders.md) to construct the headers line by line. + + + +### CreateWebResourceResponse + +> [CoreWebView2WebResourceResponse](corewebview2webresourceresponse.md) CreateWebResourceResponse([IRandomAccessStream](/uwp/api/Windows.Storage.Streams.IRandomAccessStream) Content, int StatusCode, string ReasonPhrase, string Headers) + +Creates a new [CoreWebView2WebResourceResponse](corewebview2webresourceresponse.md) object. +It is also possible to create this object with empty headers string and then use the [CoreWebView2HttpResponseHeaders](corewebview2httpresponseheaders.md) to construct the headers line by line. + + + +### CreateWithOptionsAsync + +> static [`IAsyncOperation`](/uwp/api/Windows.Foundation.IAsyncOperation-1)<CoreWebView2Environment> CreateWithOptionsAsync(string browserExecutableFolder, string userDataFolder, [CoreWebView2EnvironmentOptions](corewebview2environmentoptions.md) options) + +Creates a WebView2 Environment with a custom version of WebView2 Runtime, user data folder, and environment options. + + + +### GetAvailableBrowserVersionString + +> static string GetAvailableBrowserVersionString() + +Gets the browser version info including channel name if it is not the stable channel or WebView2 Runtime. + + + +### GetAvailableBrowserVersionString + +> static string GetAvailableBrowserVersionString(string browserExecutableFolder) + +Gets the browser version info including channel name if it is not the stable channel or WebView2 Runtime where `browserExecutableFolder` is the relative path to the folder that contains the WebView2 Runtime. + + + + +## Events + +### BrowserProcessExited + +BrowserProcessExited is raised when the collection of WebView2 Runtime processes for the browser process of this CoreWebView2Environment terminate due to browser process failure or normal shutdown (for example, when all associated WebViews are closed), after all resources have been released (including the user data folder). +Multiple app processes can share a browser process by creating their webviews from a CoreWebView2Environment with the same user data folder. When the entire collection of WebView2Runtime processes for the browser process exit, all associated CoreWebView2Environment objects receive the BrowserProcessExited event. Multiple processes sharing the same browser process need to coordinate their use of the shared user data folder to avoid race conditions and unnecessary waits. For example, one process should not clear the user data folder at the same time that another process recovers from a crash by recreating its WebView controls; one process should not block waiting for the event if other app processes are using the same browser process (the browser process will not exit until those other processes have closed their webviews too). + +Note this is an event from CoreWebView2Environment, not [CoreWebView2](corewebview2.md). The difference between BrowserProcessExited and [CoreWebView2.ProcessFailed](corewebview2.md#processfailed) is that BrowserProcessExited is raised for any **browser process** exit (expected or unexpected, after all associated processes have exited too), while [CoreWebView2.ProcessFailed](corewebview2.md#processfailed) is raised for **unexpected** process exits of any kind (browser, render, GPU, and all other types), or for main frame **render process** unresponsiveness. To learn more about the WebView2 Process Model, go to [Process model](/microsoft-edge/webview2/concepts/process-model). + +In the case the browser process crashes, both BrowserProcessExited and [CoreWebView2.ProcessFailed](corewebview2.md#processfailed) events are raised, but the order is not guaranteed. These events are intended for different scenarios. It is up to the app to coordinate the handlers so they do not try to perform reliability recovery while also trying to move to a new WebView2 Runtime version or remove the user data folder. + +Type: [TypedEventHandler](/uwp/api/Windows.Foundation.TypedEventHandler-2)<CoreWebView2Environment, [CoreWebView2BrowserProcessExitedEventArgs](corewebview2browserprocessexitedeventargs.md)> + +### NewBrowserVersionAvailable + +NewBrowserVersionAvailable is raised when a newer version of the WebView2 Runtime is installed and available using WebView2. +To use the newer version of the browser you must create a new environment and WebView. The event is only raised for new version from the same WebView2 Runtime from which the code is running. When not running with installed WebView2 Runtime, no event is raised. + +Because a user data folder is only able to be used by one browser process at a time, if you want to use the same user data folder in the WebViews using the new version of the browser, you must close the environment and instance of WebView that are using the older version of the browser first. Or simply prompt the user to restart the app. + +Type: [TypedEventHandler](/uwp/api/Windows.Foundation.TypedEventHandler-2)<CoreWebView2Environment, Object> + + + +## Referenced by + +- [CoreWebView2](corewebview2.md) diff --git a/1-0-1020-30/winrt/corewebview2environmentoptions.md b/1-0-1020-30/winrt/corewebview2environmentoptions.md new file mode 100644 index 00000000..72c6a0b3 --- /dev/null +++ b/1-0-1020-30/winrt/corewebview2environmentoptions.md @@ -0,0 +1,71 @@ +--- +description: Options used to create WebView2 Environment. +title: CoreWebView2EnvironmentOptions +ms.date: 10/28/2021 +keywords: webview2, webview, winrt, win32, edge, CoreWebView2, CoreWebView2Controller, browser control, edge html, CoreWebView2EnvironmentOptions +--- + +# CoreWebView2EnvironmentOptions Class + + + +Options used to create WebView2 Environment. +Default values will use your defaulted Edge WebView2 Runtime binaries and user data folder. + +## Summary + +Members|Description +--|-- +[AdditionalBrowserArguments](#additionalbrowserarguments) | Gets or sets the additional browser arguments to change the behavior of the WebView. +[AllowSingleSignOnUsingOSPrimaryAccount](#allowsinglesignonusingosprimaryaccount) | Determines whether to enable single sign on with Azure Active Directory (AAD) resources inside WebView using the logged in Windows account and single sign on (SSO) with web sites using Microsoft account associated with the login in Windows account. +[Language](#language) | Gets or sets the default display language for WebView. +[TargetCompatibleBrowserVersion](#targetcompatiblebrowserversion) | Gets or sets the version of the WebView2 Runtime binaries required to be compatible with your app. +[CoreWebView2EnvironmentOptions](#corewebview2environmentoptions) | Initializes a new instance of the CoreWebView2EnvironmentOptions class. + +## Properties + +### AdditionalBrowserArguments + +> string AdditionalBrowserArguments + +Gets or sets the additional browser arguments to change the behavior of the WebView. +The arguments are passed to the browser process as part of the command. For more information about using command-line switches with Chromium browser processes, navigate to [Run Chromium with Flags](https://aka.ms/RunChromiumWithFlags). The value appended to a switch is appended to the browser process, for example, in `--edge-webview-switches=xxx` the value is `xxx`. If you specify a switch that is important to WebView functionality, it is ignore, for example, `--user-data-dir`. Specific features are disabled internally and blocked from being enabled. If a switch is specified multiple times, only the last instance is used. + +A merge of the different values of the same switch is not attempted, except for disabled and enabled features. The features specified by `--enable-features` and `--disable-features` will be merged with simple logic: + +- The features are the union of the specified features and built-in features. If a feature is disabled, it is removed from the enabled features list. +If you specify command-line switches and sets this property, the `--edge-webview-switches` value takes precedence and is processed last. If a switch fails to parse, the switch is ignored. The default state for the operation is to run the browser process with no extra flags. + +### AllowSingleSignOnUsingOSPrimaryAccount + +> bool AllowSingleSignOnUsingOSPrimaryAccount + +Determines whether to enable single sign on with Azure Active Directory (AAD) resources inside WebView using the logged in Windows account and single sign on (SSO) with web sites using Microsoft account associated with the login in Windows account. +The default value is `false`. Universal Windows Platform apps must also declare `enterpriseCloudSSO` [restricted capability](/windows/uwp/packaging/app-capability-declarations#restricted-capabilities) for the single sign on (SSO) to work. + +### Language + +> string Language + +Gets or sets the default display language for WebView. +It applies to browser UIs such as context menu and dialogs. It also applies to the `accept-languages` HTTP header that WebView sends to websites. It is in the format of `language[-country]` where `language` is the 2-letter code from [ISO 639](https://www.iso.org/iso-639-language-codes.html) and `country` is the 2-letter code from [ISO 3166](https://www.iso.org/standard/72482.html). + +### TargetCompatibleBrowserVersion + +> string TargetCompatibleBrowserVersion + +Gets or sets the version of the WebView2 Runtime binaries required to be compatible with your app. +This defaults to the WebView2 Runtime version that corresponds with the version of the SDK the app is using. The format of this value is the same as the format of the [CoreWebView2Environment.BrowserVersionString](corewebview2environment.md#browserversionstring) property and other BrowserVersion values. Only the version part of the BrowserVersion value is respected. The channel suffix, if it exists, is ignored. The version of the WebView2 Runtime binaries actually used may be different from the specified TargetCompatibleBrowserVersion. They binaries are only guaranteed to be compatible. Verify the actual version on the [CoreWebView2Environment.BrowserVersionString](corewebview2environment.md#browserversionstring) property. + + +## Constructors + +### CoreWebView2EnvironmentOptions + +> CoreWebView2EnvironmentOptions() + +Initializes a new instance of the CoreWebView2EnvironmentOptions class. + +## Referenced by + +- [CoreWebView2Environment](corewebview2environment.md) diff --git a/1-0-1020-30/winrt/corewebview2frame.md b/1-0-1020-30/winrt/corewebview2frame.md new file mode 100644 index 00000000..122ed379 --- /dev/null +++ b/1-0-1020-30/winrt/corewebview2frame.md @@ -0,0 +1,72 @@ +--- +description: CoreWebView2Frame provides direct access to the iframes information and handling. +title: CoreWebView2Frame +ms.date: 10/28/2021 +keywords: webview2, webview, winrt, win32, edge, CoreWebView2, CoreWebView2Controller, browser control, edge html, CoreWebView2Frame +--- + +# CoreWebView2Frame Class + + + +CoreWebView2Frame provides direct access to the iframes information and handling. + +## Summary + +Members|Description +--|-- +[Name](#name) | The name of the iframe from the iframe html tag declaring it. +[IsDestroyed](#isdestroyed) | Check whether a frame is destroyed. Returns true during the [CoreWebView2Frame.Destroyed](corewebview2frame.md#destroyed) event. +[RemoveHostObjectFromScript](#removehostobjectfromscript) | Remove the host object specified by the name so that it is no longer accessible from JavaScript code in the iframe. +[Destroyed](#destroyed) | Destroyed event is raised when the iframe corresponding to this CoreWebView2Frame object is removed or the document containing that iframe is destroyed. +[NameChanged](#namechanged) | NameChanged is raised when the iframe changes its `window.name` property. + +## Properties + +### Name + +> readonly string Name + +The name of the iframe from the iframe html tag declaring it. + + + +## Methods + +### IsDestroyed + +> int IsDestroyed() + +Check whether a frame is destroyed. Returns true during the [CoreWebView2Frame.Destroyed](corewebview2frame.md#destroyed) event. + + + +### RemoveHostObjectFromScript + +> void RemoveHostObjectFromScript(string name) + +Remove the host object specified by the name so that it is no longer accessible from JavaScript code in the iframe. +While new access attempts are denied, if the object is already obtained by JavaScript code in the iframe, the JavaScript code continues to have access to that object. Calling this method for a name that is already removed or was never added fails. If the iframe is destroyed this method will return fail also. + + + + +## Events + +### Destroyed + +Destroyed event is raised when the iframe corresponding to this CoreWebView2Frame object is removed or the document containing that iframe is destroyed. + +Type: [TypedEventHandler](/uwp/api/Windows.Foundation.TypedEventHandler-2)<CoreWebView2Frame, Object> + +### NameChanged + +NameChanged is raised when the iframe changes its `window.name` property. + +Type: [TypedEventHandler](/uwp/api/Windows.Foundation.TypedEventHandler-2)<CoreWebView2Frame, Object> + + + +## Referenced by + +- [CoreWebView2FrameCreatedEventArgs](corewebview2framecreatedeventargs.md) diff --git a/1-0-1020-30/winrt/corewebview2framecreatedeventargs.md b/1-0-1020-30/winrt/corewebview2framecreatedeventargs.md new file mode 100644 index 00000000..f986a0d8 --- /dev/null +++ b/1-0-1020-30/winrt/corewebview2framecreatedeventargs.md @@ -0,0 +1,35 @@ +--- +description: Event args for the CoreWebView2.FrameCreated event. +title: CoreWebView2FrameCreatedEventArgs +ms.date: 10/28/2021 +keywords: webview2, webview, winrt, win32, edge, CoreWebView2, CoreWebView2Controller, browser control, edge html, CoreWebView2FrameCreatedEventArgs +--- + +# CoreWebView2FrameCreatedEventArgs Class + + + +Event args for the [CoreWebView2.FrameCreated](corewebview2.md#framecreated) event. + +## Summary + +Members|Description +--|-- +[Frame](#frame) | Gets the created frame. + +## Properties + +### Frame + +> readonly [CoreWebView2Frame](corewebview2frame.md) Frame + +Gets the created frame. + + + + + + +## Referenced by + +- [CoreWebView2](corewebview2.md) diff --git a/1-0-1020-30/winrt/corewebview2frameinfo.md b/1-0-1020-30/winrt/corewebview2frameinfo.md new file mode 100644 index 00000000..fe16f563 --- /dev/null +++ b/1-0-1020-30/winrt/corewebview2frameinfo.md @@ -0,0 +1,38 @@ +--- +description: Provides a set of properties for a frame in the CoreWebView2. +title: CoreWebView2FrameInfo +ms.date: 10/28/2021 +keywords: webview2, webview, winrt, win32, edge, CoreWebView2, CoreWebView2Controller, browser control, edge html, CoreWebView2FrameInfo +--- + +# CoreWebView2FrameInfo Class + + + +Provides a set of properties for a frame in the [CoreWebView2](corewebview2.md). + +## Summary + +Members|Description +--|-- +[Name](#name) | Gets the name attribute of the frame, as in `