Skip to content
This repository was archived by the owner on Sep 21, 2021. It is now read-only.

Conversation

@YannickRe
Copy link

This fixes #133 :

In a browser the Utilities.isAddin check return true, even when using it outside of Office. This results in the helpers trying to use the Dialog framework to open an authentication window instead of a normal browser popup.

Problematic code:

return Utilities.host !== HostType.WEB;

When used in the browser, the host property is undefined. This doesn't equal WEB and therefor it is considered being in an AddIn.

Not sure who owns this anymore, so I'm tagging all: @casieber, @Zlatkovsky, @sumurthy & @LouMM

*/
static get isAddin() {
return Utilities.host !== HostType.WEB;
return !!Utilities.host && Utilities.host !== HostType.WEB;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, I think the bigger issue is that Utilities.host returns undefined. This must be a regression (relative to the "@microsoft/office-js-helpers": "0.7.4" that Script Lab uses).

I remember running into something similar with Script Lab, hence we just stayed on 0.7.4. It would be good to diff it to see what the real culprit is.

Let me see if I can identify the issue later today.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, I just submitted #135
I would recommend that as a fix

Copy link
Member

@Zlatkovsky Zlatkovsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, I just submitted #135.

I would recommend that as a better fix, in that it solves this issue, and also the Utilities.host/Utilities.platform APIs. At which point, this PR is no longer needed/relevant.

That said, @YannickRe , thanks for bringing this up to our attention, and prompting me to look into the underlying issue.

*/
static get isAddin() {
return Utilities.host !== HostType.WEB;
return !!Utilities.host && Utilities.host !== HostType.WEB;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, I just submitted #135
I would recommend that as a fix

@YannickRe
Copy link
Author

#135 is a better fix, closing this one!

@YannickRe YannickRe closed this May 6, 2019
@YannickRe YannickRe deleted the UpdatedIsAddinCheck branch May 8, 2019 07:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IsAddin check fails in Browser, still returns true and uses Dialog framework

2 participants