在对话框中打开另一个页面

Open another page in Dialog box

我正在尝试使用 Dialog box

在我的加载项中,我有两个按钮 openGoogleopenWhosebug,其中 link 到 openDialog("https://www.google.com")openDialog("https://www.stackoverlfow.com"):

function openDialog(url) {
      Office.context.ui.displayDialogAsync(url, { height: 1100, width: 1000 }, 
            function (result) {
                console.log("here")
                dialog = result.value;
            }
        )
}

首先,我通过单击 openGoogle 打开一个对话框,然后如果我单击 openWhosebug,将再次显示 here,但是该对话框不会转到 Whosebug。

有人知道怎么回事吗?

来自documentation

the page, controller method, or other resource that is passed to the displayDialogAsync method must be in the same domain as the host page.

如果您需要将用户引导至另一个域,您可以通过首先在您的加载项中打开一个页面的对话框,然后立即使用 window.location.href = "https://www.stackoverlfow.com";[=13 将他们重定向到外部域来实现=]