If you specified callback when calling the displayDialogAsync
method, you may check result.error.code
and result.error.message
. As soon as you know what the actual error is, you can start troubleshooting, for example:
var dialog;
Office.context.ui.displayDialogAsync('https://myDomain/myDialog.html',
function (asyncResult) {
if (asyncResult.status === Office.AsyncResultStatus.Failed) {
showNotification(asyncResult.error.code = ": " + asyncResult.error.message);
} else {
dialog = asyncResult.value;
dialog.addEventHandler(Office.EventType.DialogMessageReceived, processMessage);
}
});
Check out the Handle errors and events in the Office dialog box for well-known errors.
Also you may find the Troubleshoot development errors with Office Add-ins page helpful.
Also make sure that the Protected mode is turned off in Windows.
In Windows 11, Protected Mode
settings are missing in Internet Options, but you still can modify them via registry editor. These settings are stored in HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones
. Under Zones is a subkey for each zone, named numerically:
0 is the Local Machine zone
1 is the Intranet zone
2 is the Trusted Sites zone
3 is the Internet zone
4 is the Restricted Sites zone
Under each numerically-named key, you can create or set a REG_DWORD value named 2500 to control whether Protected Mode is enabled for the zone. Setting that value to 0 enables Protected Mode; a setting of 3 disables it.
So, to disable Protected Mode
for the Internet zone, set this entry to 3:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3\2500