I have a mean-stack website. I want to use ExecuteFunction to bind a button to launch this website in a Dialog box. Here is my 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>
And in manifest.xml
I use:
<FunctionFile resid="Contoso.DesktopFunctionFile.Url" />
... ...
<bt:Url id="Contoso.DesktopFunctionFile.Url" DefaultValue="https://localhost:3000/htmls/FunctionFile.html" />
I realise that after the loading of the manifest, we could launch the dialog box by clicking on the button. However, after closing the dialog manually and clicking on the button again, we need to wait several minutes to see the notification window ... wants to display a new window
. There is no error in the console.
Does anyone know what's wrong here?