添加office.js会禁用html5mode [英] Adding office.js disables html5mode
问题描述
我有一个平均堆栈网站,它通过 $ locationProvider.html5Mode(true)
启用 html5mode
。和 index.html
如下所示:
I have a mean-stack website which enables html5mode
by $locationProvider.html5Mode(true)
. and index.html
looks like as follows:
<html>
<head>
<base href="/" />
...
</head>
<body ng-app="f">
<ui-view ng-cloak></ui-view>
</body>
</html>
由于 html5mode
,我们可以加载浏览器,例如。 https:// localhost:3000 / home
,保持不变;没有 html5mode
,该网址将变为 https:// localhost:3000 /#/ home
。
Because of html5mode
, we can load in a browser, eg. https://localhost:3000/home
, which will remain the same; without html5mode
, that url would become https://localhost:3000/#/home
.
现在我希望服务器(除了网站之外)也是一个Office加载项。我需要能够在加载项清单文件中执行< SourceLocation DefaultValue =https:// localhost:3000 / addin/>
。为此,我需要添加
< script src =https://appsforoffice.microsoft.com/lib/1/hosted/office.js>< / script> ;
in index.html
。
Now I want the server to serve (besides the web site) also an Office add-in. I will need to be able to do <SourceLocation DefaultValue="https://localhost:3000/addin" />
in an add-in manifest file. To this end, I need to add
<script src="https://appsforoffice.microsoft.com/lib/1/hosted/office.js"></script>
in index.html
.
但是,我意识到添加<$后c $ c>< script src =https://appsforoffice.microsoft.com/lib/1/hosted/office.js>< / script> in index.html
,在浏览器中加载 https:// localhost:3000 / home
变为 https: // localhost:3000 /#/ home
,这意味着添加 office.js
禁用 html5mode
。
However, I realise that after adding <script src="https://appsforoffice.microsoft.com/lib/1/hosted/office.js"></script>
in index.html
of the website, loading https://localhost:3000/home
in a browser becomes https://localhost:3000/#/home
, which means adding office.js
disables html5mode
.
有谁知道怎么回事?有没有人有解决方法?
Does anyone know how to what's wrong? Does anyone have a workaround?
推荐答案
将评论作为答案
据我所知,只有办公室应用程序才需要 office.js
,在这种情况下,不会给你的web-app带来office-js的负担。使用 ocLazyLoad (或其他类似的库)加载 office.js
仅在需要时可选/动态。
As I understand, office.js
is needed only for office app, in that case do not burden your web-app with office-js. Use ocLazyLoad (or some other similar library) to load the office.js
optionally/dynamically only when needed.
这篇关于添加office.js会禁用html5mode的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!