function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jean-Francois LabbéJean-Francois Labbé 

Mobile Publisher context

If I develop a Lightning Web Component (LWC) and want this component to behave or to display different styles based on the container where this component is shown. (Web based Community vs Mobile publisher community) Is there a way to know that my community is viewed on a browser or on the Mobile Publisher container ? I was wondering if there’s a global attribute that I can get to know the context of even a class added in the HTML body ?
Best Answer chosen by Jean-Francois Labbé
SwethaSwetha (Salesforce Developers) 
HI Jean,
You can use the $Browser value provider to determine if you're on a Windows, iOS, or Android phone, or if you're running on a phone, tablet, or full-sized device.

See below for more insight
https://salesforce.stackexchange.com/questions/186192/is-there-any-predefined-global-function-in-lightning-component-to-detect-ie-11-b

https://salesforce.stackexchange.com/questions/240783/how-to-detect-browser-in-lightning-component-for-desktop-and-mobile-both

https://salesforce.stackexchange.com/questions/277742/device-detection-in-lwc?noredirect=1&lq=1

Hope this helps you. Please mark this answer as best so that others facing the same issue will find this information useful. Thank you

All Answers

SwethaSwetha (Salesforce Developers) 
HI Jean,
You can use the $Browser value provider to determine if you're on a Windows, iOS, or Android phone, or if you're running on a phone, tablet, or full-sized device.

See below for more insight
https://salesforce.stackexchange.com/questions/186192/is-there-any-predefined-global-function-in-lightning-component-to-detect-ie-11-b

https://salesforce.stackexchange.com/questions/240783/how-to-detect-browser-in-lightning-component-for-desktop-and-mobile-both

https://salesforce.stackexchange.com/questions/277742/device-detection-in-lwc?noredirect=1&lq=1

Hope this helps you. Please mark this answer as best so that others facing the same issue will find this information useful. Thank you
This was selected as the best answer
Jean-Francois LabbéJean-Francois Labbé
Thanks, I will try to see if I can get a special browser attribute on Mobile Publisher container.
JonathanFoxJonathanFox

Hi Jean!

Did you even find any attributes which could show the user was from a Mobile Publisher context?

Jean-Francois LabbéJean-Francois Labbé
Hi Jonathan,

I'm using an Aura based theme and I did not found any Aura attributes that flag if my theme is viewed on mobilePublisher or Experience site... the browser detection wasn't reliable enough.. Maybe the new LWC based theme has an attribute (I didn't verify)

Thanks,
Luiza ZdebskaLuiza Zdebska

Hello! I have encountered a requirement from Salesfroce to track BOTH ACCESS_BACKGROUND_LOCATION and ACCESS_FINE_LOCATION of our mo app users (https://salesforce-marketingcloud.github.io/MarketingCloudSDK-iOS/location/geolocation-overview.html )  Hovewer our app was forbidden to track ACCESS_BACKGROUND_LOCATION by Apple & Google.

I would like Salesforce to make changes in their requirements location so that ONLY ACCESS_FINE_LOCATION is needed for Geopushes sending. (WITHOUT ACCESS_BACKGROUND_LOCATION)
These changes will allow 19 500 customers, including our retail company goodwine Ukraine, to use all functionalities of Marketing Cloud that will contribute in sales boosting.

Please, vote for my idea at ideaexchange here: https://trailblazer.salesforce.com/ideaView?id=0874V0000010znOQAQ