0
我有一個Outlook插件的JavaScript API,並從我的網站,我想重定向到正確的環境的應用程序,如何檢測Office 365中的環境?
var isSetSupported = function(Application, version) {
return window["Office"] && Office.context.requirements && Office.context.requirements.isSetSupported(Application + 'Api', version);
};
//heck to return the powerpoint library because isSetSupported returns false for PowerpointApi 1.0| 1.1| 1.2 returns false
var isPowerpointEnviroment = function() {
return window.location.search.indexOf('_host_Info=Powerpoint') != -1;
}
//heck to return the outlook library because isSetSupported returns false for OutlookApi 1.0| 1.1| 1.2 returns false
var isOutlookEnviroment = function() {
return window.location.search.indexOf('_host_Info=Outlook') != -1 || (window.external && window.external.GetContext && typeof window.external.GetContext() == 'object');
}
if (isSetSupported("Word", 1.1)) {
return "wordJs";
}
if (isSetSupported("Excel", 1.1)) {
return "excelJs";
}
if (isOutlookEnviroment()) {
return "outlookJs";
}
if (isPowerpointEnviroment()) {
return "powerpointJs";
}
return "webApp";
從本地計算機的前景它是這樣工作的,但對於office365展望它不起作用。
我們正在評估加入一個API來檢測主機(「的Excel,Word,Outlook中等等)和平臺(桌面,Mac,Web等)信息爲了確保我們正在考慮它,你介紹一下你正在面對的特定用例,這導致你尋求這個API嗎?謝謝! –