0
我有一個平均堆棧網站。我想用ExecuteFunction綁定一個按鈕在對話框中啓動這個網站。這裏是我的FunctionFile.html
:第二次打開對話框之前必須等待幾分鐘
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />
<title></title>
<script src="https://appsforoffice.microsoft.com/lib/1/hosted/office.js" type="text/javascript"></script>
<script>
var clickEvent;
(function() {
Office.initialize = function (reason) {
};
})();
function showNotification(text)
{
writeToDoc(text);
clickEvent.completed();
}
function doSomethingAndShowDialog(event) {
clickEvent = event;
Office.context.ui.displayDialogAsync("https://www.google.com", {}, function() {})
}
function writeToDoc(text)
{
Office.context.document.setSelectedDataAsync(text,
function (asyncResult) {
var error = asyncResult.error;
if (asyncResult.status === "failed") {
console.log("Unable to write to the document: " + asyncResult.error.message);
}
});
}
</script>
</head>
<body>
Function file body is never displayed.
</body>
</html>
而在manifest.xml
我用:
<FunctionFile resid="Contoso.DesktopFunctionFile.Url" />
... ...
<bt:Url id="Contoso.DesktopFunctionFile.Url" DefaultValue="https://localhost:3000/htmls/FunctionFile.html" />
我意識到清單的加載後,我們可以通過點擊按鈕來啓動該對話框。但是,手動關閉對話框並再次單擊該按鈕後,我們需要等待幾分鐘才能看到通知窗口... wants to display a new window
。控制檯中沒有錯誤。
有沒有人知道這裏有什麼問題?
我寫谷歌爲例。最初它是我的域名上的幫助頁面。我稍後會糾正它。 – SoftTimur
無論頁面是否在我的域名上,都存在問題... – SoftTimur
頁面是否在重定向之前處理office.initialize? –