Reputation: 21
This is in regards to Apps for Office.
I have two pages: Home.html and Details.Html. Once I load some data into a table in Excel, I then use location.href="Details.html"
to load the page Details.html. Within Details the Javascript file has:
Office.initialize = function (reason) {
$(document).ready(function () {
app.initialize();
$('#get-employee-details').click(getEmployeeDetails);
});
};
But before it even gets to that code, I get an error coming from office.js stating:
Unhandled exception at line 11, column 11313 in https://appsforoffice.microsoft.com/lib/1.1/hosted/office.js
0x800a139e - JavaScript runtime error: Office.js has not been fully loaded yet. Please try again later or make sure to add your initialization code on the Office.initialize function.
The only Javascript code is inside the Office initialize function so I am lost as to why I am getting this error.
Upvotes: 1
Views: 414
Reputation: 580
I have a current office app that I developed, this is how I am doing what you are looking for, I hope you get an Idea of how to do it. Currently I have a menu selector which gives me the user desired intent and it then goes to my switch statement.
function MenuSelection(Location) {
switch (Location) {
case "Firm Bios":
window.location = "https://localhost:44348/FirmBios/FirmBios.html?_host_Info=Word|Win32|16.01|en-US";
break;
case "Graphics":
window.location = "https://localhost:44348/Graphics/Graphics.html?_host_Info=Word|Win32|16.01|en-US";
break;
case "R&P Questions":
window.location = "https://localhost:44348/R_PQuestions/R_PQuestions.html?_host_Info=Word|Win32|16.01|en-US";
break;
case "General Content":
window.location = "https://localhost:44348/GeneralContent/GeneralContent.html?_host_Info=Word|Win32|16.01|en-US";
break;
}
Upvotes: 0
Reputation: 21
Problem turned out to be path to the Javascript file was incorrect and thus the Office.Initialize function never fired. If anyone else runs into this error make sure their Javascript is running (set a breakpoint) and make sure every HTML page in the app for office calls Office.initialize.
Upvotes: 1