As this answer suggested, I want to modify a little bit office.js
.
So I copied the content of https://appsforoffice.microsoft.com/lib/1/hosted/office.js
to local, such that https://localhost:3000/static/office.js
shows well the content.
Then, I make a very simple file test.html
:
<html>
<head>
<!--<script src="https://appsforoffice.microsoft.com/lib/1/hosted/office.js"></script>-->
<script type="text/javascript" src="https://localhost:3000/static/office.js"></script>
</head>
<body>
haha
</body>
</html>
Loading https://localhost:3000/static/test.html
with remote office.js
in a browser shows Warning: Office.js is loaded outside of Office client
o15apptofilemappingtable.js:11
, and loading it in an Office add-in works well.
However, loading https://localhost:3000/static/test.html
with local office.js
in a browser shows Uncaught SyntaxError: Unexpected token <
o15apptofilemappingtable.js:1
, and loading it in an Office add-in gives an error Add-in Error Something went wrong and we couldn't start this add-in. Please try again later or contact your system administrator
.
So does anyone know what's wrong here? Is it possible to make our own local version of office.js
?