如何解决Word加载项身份验证对话框未关闭
我在office-login-callback.html中使用了此代码 该页面已加载,并且那里有一个有效的令牌。
如果我将加载项加载到excel中,则一切正常,但是在Word中,对话框永远不会关闭...
您知道我在做什么错吗,还是Word Online存在问题?
<!DOCTYPE html>
<html lang="en">
<head>
<Meta charset="utf-8" />
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
<Meta name="viewport" content="width=device-width,initial-scale=1" />
<Meta name="theme-color" content="#000000" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico","%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>Validating your login...</title>
<script type="text/javascript">
var script = document.createElement('script');
script.src = "https://appsforoffice.microsoft.com/lib/1.1/hosted/Office.js";
script.type = "text/javascript";
script.onload = function () {
Office.onReady(async (info) => {
console.log("Ready",info);
if (/(access_token|code|error|state)/gi.test(location.href)) {
Office.context.ui.messageParent(JSON.stringify({ parse: false,value: location.href }));
console.log("that's all folks!");
}
});
}
document.getElementsByTagName('head')[0].appendChild(script);
</script>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root">Just checking your credentials...</div>
</body>
</html>
将调用Office.onReady,并且控制台日志中的内容为“这就是所有人!”。显示。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。