web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Detect web browser users
Power Apps
Answered

Detect web browser users

(3) ShareShare
ReportReport
Posted on by 284

Hi All,

I understand that the SaveData data and Load data funcations are currently only supported on studio and moble. I would like to detect whether users are studio or mobile so I can avoid these functions when using the web browser. How can i go about doing this.

Currently im using this but it isnt really working.

Set(IsBrowser, !IsEmpty(Errors(SaveData(testCollection, "TestSave")))) 

 

Categories:
  • Verified answer
    claudiosvcc Profile Picture
    Microsoft Employee on at

    From what I'm seeing here that's happening because SaveData does not return an error, so your logic would be broken.

    I'm not sure if there's a best approach, but you can get unblocked with this:


    Set(IsSaveDataSupported, !(CountRows(SaveData(["1", "2"],"myTestList").Value)=2))

     

    I've put this on first screen's OnStart and that worked fine.

    Hope it helps

     

    Please, keep in mind that SaveData might change its behavior in the future (e.g., to return an Error). 

  • Brian Dang Profile Picture
    3,976 on at

    This is going to help me out a lot!

     

    Can I get a clarification though, @claudiosvcc.

     

    Set(IsSaveDataSupported, !(CountRows(SaveData(["1", "2"],"myTestList").Value)=2))

    If I understand correctly, this means, "Check if myTestList returns 2 rows. If SaveData returns 2, the ! in red means take the opposite of that, so the variable returns false. If it doesn't return 2, the ! causes the variable to return true." I assume @AnthonyPhan wants the variable to return true if SaveData does not work, so this makes sense.

     

    I am confused because with the NOT (!), the name of the variable may be mismatched. Would the variable be more appropriately named something like "IsSaveDataNotSupported"? Or did I misunderstand the formula logic?

     

  • AnthonyPhan Profile Picture
    284 on at

    Hi @mr-dang

    Your understanding of the logic is correct. The variable could be better named as "IsSaveDataNotSupported".

     

    @claudiosvcc Another thing worth mentioning is on start you will recieve an error message in web browser mode. Is there any way to hide this to improve the user experience for the browser users?

    image.png

  • FredTherrien Profile Picture
    46 on at

    @claudiosvcc I have the same issue. Is it possible to hide this error message? 

     

    Thanks

  • AnthonyPhan Profile Picture
    284 on at

    Hi @FredTherrien

    I found that for my purposes checking if there are any accelerometer readings was a work around. Within my organisation all mobile devices had accelerometers and all desktop device did not. By checking this instead of saveData I was able to throw no error and accuratly differentiate between devices

     

    Set(IsSaveDataSupported, !IsBlank(Acceleration.X));
  • claudiosvcc Profile Picture
    Microsoft Employee on at

    You're right.

    I think I was using locally IsBrowser and renamed it.

    Sorry for that

  • FredTherrien Profile Picture
    46 on at

    Thanks @AnthonyPhan this is a great workaround!

  • keathley Profile Picture
    142 on at

    For anyone else that comes across this thread and is looking to use @AnthonyPhan's suggestion (many thanks Anthony), I ran into an issue (maybe its with the latest version) whereas:

     

    Set(IsSaveDataSupported, !IsBlank(Acceleration.X))

    occasionally sets IsSaveDataSupported = false on my mobile device when the formula is set on the OnStart function of the first screen of the app.  I actually found it inconsistent with each open of the app it may be true or it may be false seemingly randomly.  However, when I put a (500ms AutoStart AutoPause) Timer on the first screen, and set the OnTimerEnd function to the same formula it consistently returns true on my mobile and false on the web (as expected).  It appears that Acceleration.X is sometimes blank right at the startup of the app (maybe it takes a moment for the accelerometer to be enabled?).

  • CU-18081211-6 Profile Picture
    9,272 Moderator on at

    An exceptional idea !!!

  • ehg Profile Picture
    18 on at

    Hi guys, here is my solution...

    In my case, I just needed my app to know which device it was running on between browser and mobile app, and then display a popup if it is running on mobile. So what I did was this: 

     

      OnVisible (screen):  // triger //

    ClearCollect(collName, true);    // here I created a collection with a single value: true //
    SaveData(collName, "fileName");   // try to save that collection wich doesn't work on a browser, just mobile app //
    Clear(collName);        // delete the value I collected previously //
    LoadData(collName, "fileName",true);   // try to load the data to an emptied collection, if it doesn't load it is because we aren't on mobile //
    If( !IsEmpty(collName),  "do what i want")      // finally, check if the data was loaded corectly and only do the action that i want if so //

    This is just a simple idea that worked for me, hopefully, it can be of help to you guys. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 345 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 225

#3
M Bilal Khan Profile Picture

M Bilal Khan 192

Last 30 days Overall leaderboard