You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/develop/dialog-handle-errors-events.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: Handling errors and events in the Office dialog box
3
3
description: Learn how to trap and handle errors when opening and using the Office dialog box.
4
-
ms.date: 05/10/2024
4
+
ms.date: 03/11/2025
5
5
ms.topic: error-reference
6
6
ms.localizationpriority: medium
7
7
---
@@ -11,13 +11,13 @@ ms.localizationpriority: medium
11
11
This article describes how to trap and handle errors when opening the dialog box and errors that happen inside the dialog box.
12
12
13
13
> [!NOTE]
14
-
> This article presupposes that you are familiar with the basics of using the Office dialog API as described in [Use the Office dialog API in your Office Add-ins](dialog-api-in-office-add-ins.md).
14
+
> This article presupposes that you're familiar with the basics of using the Office dialog API as described in [Use the Office dialog API in your Office Add-ins](dialog-api-in-office-add-ins.md).
15
15
>
16
16
> See also [Best practices and rules for the Office dialog API](dialog-best-practices.md).
17
17
18
18
Your code should handle two categories of events.
19
19
20
-
- Errors returned by the call of `displayDialogAsync` because the dialog box cannot be created.
20
+
- Errors returned by the call of `displayDialogAsync` because the dialog box can't be created.
21
21
- Errors, and other events, in the dialog box.
22
22
23
23
## Errors from displayDialogAsync
@@ -26,7 +26,7 @@ In addition to general platform and system errors, four errors are specific to c
26
26
27
27
|Code number|Meaning|
28
28
|:-----|:-----|
29
-
|12004|The domain of the URL passed to `displayDialogAsync` isn't trusted. The domain must be the same domain as the host page (including protocol and port number).|
29
+
|12004|The domain of the URL passed to `displayDialogAsync` isn't trusted. The domain must be the same domain as the host page (including protocol and port number).<br><br>In Outlook on the web and the [new Outlook on Windows](https://support.microsoft.com/office/656bb8d9-5a60-49b2-a98b-ba7822bc7627), this error occurs when an add-in is hosted on a localhost server and its manifest doesn't specify an [AppDomain](/javascript/api/manifest/appdomain) element for localhost.|
30
30
|12005|The URL passed to `displayDialogAsync` uses the HTTP protocol. HTTPS is required. (In some versions of Office, the error message text returned with 12005 is the same one returned for 12004.)|
31
31
|<spanid="12007">12007</span><!-- The span is needed because office-js-helpers has an error message that links to this table row. -->|A dialog box is already opened from this host window. A host window, such as a task pane, can only have one dialog box open at a time.|
32
32
|12009|The user chose to ignore the dialog box. This error can occur in Office on the web, where users may choose not to allow an add-in to present a dialog box. For more information, see [Handling pop-up blockers with Office on the web](dialog-best-practices.md#handle-pop-up-blockers-with-office-on-the-web).|
@@ -53,7 +53,7 @@ Three errors and events in the dialog box will raise a `DialogEventReceived` eve
53
53
54
54
|Code number|Meaning|
55
55
|:-----|:-----|
56
-
|12002|One of the following:<ul><li>No page exists at the URL that was passed to `displayDialogAsync`.</li><li>The page that was passed to `displayDialogAsync` loaded, but the dialog box was then redirected to a page that it cannot find or load, or it has been directed to a URL with invalid syntax.</li></ul>|
56
+
|12002|One of the following:<ul><li>No page exists at the URL that was passed to `displayDialogAsync`.</li><li>The page that was passed to `displayDialogAsync` loaded, but the dialog box was then redirected to a page that it can't find or load, or it has been directed to a URL with invalid syntax.</li></ul>|
57
57
|12003|The dialog box was directed to a URL with the HTTP protocol. HTTPS is required.|
58
58
|12006|One of the following:<ul><li>The dialog box was closed, usually because the user chose the **Close** button **X**.</li><li>The dialog returned a [Cross-Origin-Opener-Policy: same-origin](https://developer.mozilla.org/docs/Web/HTTP/Headers/Cross-Origin-Opener-Policy) response header. To prevent this, you must set the header to `Cross-Origin-Opener-Policy: unsafe-none` or configure your add-in and dialog to be in the same domain as the host page.</li></ul>|
59
59
@@ -75,7 +75,7 @@ For an example of a handler for the `DialogEventReceived` event that creates cus
75
75
functionprocessDialogEvent(arg) {
76
76
switch (arg.error) {
77
77
case12002:
78
-
showNotification("The dialog box has been directed to a page that it cannot find or load, or the URL syntax is invalid.");
78
+
showNotification("The dialog box has been directed to a page that it can't find or load, or the URL syntax is invalid.");
79
79
break;
80
80
case12003:
81
81
showNotification("The dialog box has been directed to a URL with the HTTP protocol. HTTPS is required."); break;
0 commit comments