Excel桌面端加载项认证弹窗触发"No application to open url about:blank"错误求助
Hey Matteo, I’ve dealt with this exact headache before when working on Excel desktop add-ins—super frustrating since it works perfectly in the web version! Let me walk you through the fixes that resolved the issue for me and others in the dev community:
Skip
about:blankas the initial dialog URL
Desktop Excel has weird handling forabout:blankas the starting point for dialogs. Instead of opening a blank window first and then redirecting to your auth page, pass your actual authorization URL directly toOffice.context.ui.displayDialogAsync. This avoids the fallback toabout:blankthat triggers the error.Add your auth domain to the manifest’s
AppDomains
If your auth flow redirects to an external domain, desktop Excel blocks this unless the domain is explicitly trusted. Open your add-in’smanifest.xmland make sure your auth domain is listed in theAppDomainssection:<AppDomains> <AppDomain>https://your-authentication-domain.com</AppDomain> </AppDomains>Without this, the dialog can’t navigate to your auth page and gets stuck on
about:blank.Avoid delayed redirects in the dialog
If your code opensabout:blankand then uses JavaScript to redirect after a delay, Excel’s security sandbox might block the redirect. Either redirect immediately when the blank window loads, or better yet, skip the blank window entirely as mentioned earlier.Update Excel to the latest version
Older builds of Excel desktop had bugs with the dialog API that caused this exact error. Check for updates in Excel (File > Account > Update Options > Update Now) to rule out version-specific issues.Use
messageParentfor auth callbacks
Instead of redirecting back toabout:blankafter auth completes, send the token or auth data directly to your main add-in usingOffice.context.ui.messageParent(). This keeps the dialog flow contained and avoids any issues with blank URLs.
Hope one of these fixes gets your auth flow working smoothly on desktop Excel!
内容的提问来源于stack exchange,提问作者user1098381

