New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SharePoint native mobile app (iOS / Android) detection & deep linking #1472

Open
kmees opened this Issue Mar 15, 2018 · 6 comments

Comments

Projects
None yet
6 participants
@kmees

kmees commented Mar 15, 2018

Category

  • Question
  • Typo
  • Bug
  • Additional article idea

Is there a way to detect if the user is using the native mobile app for SharePoint? My SPFx WebPart needs to behave slightly differently in a mobile app than in the browser. Also, is there a way to deep link directly to a user profile in the mobile app?

Thanks

@VesaJuvonen

This comment has been minimized.

Contributor

VesaJuvonen commented Mar 15, 2018

This should be possible with user-agent inspection, but we'll confirm the right model in a day or two if there's additional ways to do this.

@russgove

This comment has been minimized.

russgove commented Mar 15, 2018

@kmees

This comment has been minimized.

kmees commented Mar 16, 2018

@VesaJuvonen i had looked at the user agent already but it seemd a bit hacky.

Mobile App (iOS):

Mozilla/5.0 (iPhone; CPU iPhone OS 11_2_6 like Mac OS X) AppleWebKit/604.5.6 (KHTML, like Gecko) Mobile/15D100

Safari (iOS)

Mozilla/5.0 (iPhone; CPU iPhone OS 11_2_6 like Mac OS X) AppleWebKit/604.5.6 (KHTML, like Gecko) Version/11.0 Mobile/15D100 Safari/604.1

The only difference is the missing Safari part. Haven't tested Android yet.

@tidg

This comment has been minimized.

tidg commented Aug 23, 2018

Hi @VesaJuvonen,
Do you have any information about this case?
Is the user agent the only way to detect that we are on the Sharepoint app?
I tried to watch the ribbon content with document.getElementById('SuiteNavPlaceHolder').innerHTML === "", but when it takes times to load on browser, we find ourselves in the same case that we are on the Sharepoint App or on the browser.
Waiting for your feedback.

@JosueRuiz89

This comment has been minimized.

JosueRuiz89 commented Aug 29, 2018

Hi,

I'm also using some elements in DOM as workaround but seems a little bit hacky, A JavaScript environment/context variable would be great, I have been trying to find a clean way to identify if user is using SharePoint App without success, I subscribed to the thread, hope this get answered some day.

@joaoferreira

This comment has been minimized.

joaoferreira commented Dec 2, 2018

My 2 cents on this one to detect the environment where the page is rendered based on the user agent of Microsoft Teams and SharePoint mobile app

if (navigator.userAgent.indexOf('Linux') != -1 && navigator.userAgent.indexOf('wv') != -1) {
	console.log("SharePoint APP - Android");
}else if (navigator.userAgent.indexOf('iPhone') != -1 && navigator.userAgent.indexOf('Safari') == -1) {
	console.log("SharePoint APP - iOS iphone");
}else if (navigator.userAgent.indexOf('iPad') != -1 && navigator.userAgent.indexOf('Safari') == -1) {	
	console.log("SharePoint APP - iOS iPad");
}else if (navigator.userAgent.indexOf('iPhone') != -1 && navigator.userAgent.indexOf('Safari') == -1) {
	console.log("SharePoint APP - iOS Iphone");
}else if (navigator.userAgent.indexOf('Teams') != -1 && navigator.userAgent.indexOf('Electron') != -1) {
	console.log("Microsoft Teams - Desktop APP");
}else{
	console.log("Browser");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment