Office.js Excel 加载项对话框提示在新 window 中打开,即使对话框宿主与函数文件宿主相同
Office.js Excel Add-In Dialog Prompts to open in new window even though Dialog host is same as function file host
来自我的manifest.xml
<bt:Url id="Contoso.DesktopFunctionFile.Url" DefaultValue="https://localhost:4000/excel-refresh" />
来自我的函数文件
Office.context.ui.displayDialogAsync('https://localhost:4000/excel-dialog?action=loading', {height:50, width:50}, dialogCallback)
加载项不会在 Excel Online 本身加载我的页面,而是提示我在新选项卡中打开它。单击“允许”后,我的 html 页面会在新选项卡中加载。我使用相同的主机和端口,所以这不应该发生。
Screenshot of generic popup that appears
根据 OP 问题下的评论,解决方案是将 Options 对象传递给 displayDialogAsync
的调用,将 displayInIframe
设置为 true。示例:
displayDialogAsync("https://myDomain/myPage.html", {height:50, width:50, displayInIframe: true}, dialogCallback);
来自我的manifest.xml
<bt:Url id="Contoso.DesktopFunctionFile.Url" DefaultValue="https://localhost:4000/excel-refresh" />
来自我的函数文件
Office.context.ui.displayDialogAsync('https://localhost:4000/excel-dialog?action=loading', {height:50, width:50}, dialogCallback)
加载项不会在 Excel Online 本身加载我的页面,而是提示我在新选项卡中打开它。单击“允许”后,我的 html 页面会在新选项卡中加载。我使用相同的主机和端口,所以这不应该发生。
Screenshot of generic popup that appears
根据 OP 问题下的评论,解决方案是将 Options 对象传递给 displayDialogAsync
的调用,将 displayInIframe
设置为 true。示例:
displayDialogAsync("https://myDomain/myPage.html", {height:50, width:50, displayInIframe: true}, dialogCallback);