# Check platform type

**URL:** <https://forum.xojo.com/t/check-platform-type/72508>\
**Category:** Web\
**Created:** [October 1, 2022, 12:46pm UTC](https://forum.xojo.com/t/check-platform-type/72508 "2022-10-01T12:46:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Herman\_Dubach](https://forum.xojo.com/letter_avatar_proxy/v4/letter/h/76d3ee/32.png) [@Herman\_Dubach](https://forum.xojo.com/u/Herman_Dubach)\
**Post date:** [October 1, 2022, 12:46pm UTC](https://forum.xojo.com/t/check-platform-type/72508/1 "2022-10-01T12:46:28Z")

</div>

I want to check if a session runs on mobile or desktop.  
This code below is copied from the xojo documentation.

select case self.Platform

case WebSession.PlatformType.desktop  
LoginDesktop.show

case else

end select

When I compile I get the error: This item does not exist. (WebSession.PlatformType.deskTop)  
What’s wrong?

---

<div class="post-metadata">

**Author:** ![AlbertoD](https://forum.xojo.com/letter_avatar_proxy/v4/letter/a/dbc845/32.png) [@AlbertoD](https://forum.xojo.com/u/AlbertoD)\
**Post date:** [October 1, 2022, 2:15pm UTC](https://forum.xojo.com/t/check-platform-type/72508/2 "2022-10-01T14:15:51Z")

</div>

> [@Herman\_Dubach](#):
>
> WebSession.PlatformType.desktop

I think that code is for Web 1, so if you are using Xojo2020 or later, that code will not work.

Found this thread:

> [@websession.PlatformType is no longer exist?](https://forum.xojo.com/t/websession-platformtype-is-no-longer-exist/56343):
>
> where can we see replacement for websession.PlatformType?

Can you share the link to the documentation? Maybe there is a documentation bug that needs to be fixed.

---

<div class="post-metadata">

**Author:** ![Ricardo\_Cruz](https://forum.xojo.com/user_avatar/forum.xojo.com/ricardo_cruz/32/7852_2.png) [@Ricardo\_Cruz](https://forum.xojo.com/u/Ricardo_Cruz)\
**Post date:** [October 1, 2022, 2:42pm UTC](https://forum.xojo.com/t/check-platform-type/72508/3 "2022-10-01T14:42:39Z")

</div>

This is some code @Alvaro_Fontan and I wrote, during the Xojo Developer Retreat:

```auto
Try
  Var rx As New RegEx
  rx.SearchPattern = "android|iphone|kindle|ipad"
  rx.Options.CaseSensitive = False
  
  Var userAgent As String = Session.Header("User-Agent")
  Var match As RegExMatch = rx.Search(userAgent)
  Return match <> Nil And match.SubExpressionCount > 0
Catch e As RegExException
  Return False
End Try

```

But as @Greg_O said in the other thread, maybe you just need to detect the screen size, using [WebSession.ClientWidth](https://documentation.xojo.com/api/web/websession.html#websession-clientwidth) and [WebSession.ClientHeight](https://documentation.xojo.com/api/web/websession.html#websession-clientheight).

---

<div class="post-metadata">

**Author:** ![Herman\_Dubach](https://forum.xojo.com/letter_avatar_proxy/v4/letter/h/76d3ee/32.png) [@Herman\_Dubach](https://forum.xojo.com/u/Herman_Dubach)\
**Post date:** [October 1, 2022, 2:42pm UTC](https://forum.xojo.com/t/check-platform-type/72508/4 "2022-10-01T14:42:42Z")

</div>

[http://man.hubwiz.com/docset/Xojo.docset/Contents/Resources/Documents/docs.xojo.com/UserGuide\_Web\_Mobile\_Support.html](http://man.hubwiz.com/docset/Xojo.docset/Contents/Resources/Documents/docs.xojo.com/UserGuide_Web_Mobile_Support.html)

---

<div class="post-metadata">

**Author:** ![Herman\_Dubach](https://forum.xojo.com/letter_avatar_proxy/v4/letter/h/76d3ee/32.png) [@Herman\_Dubach](https://forum.xojo.com/u/Herman_Dubach)\
**Post date:** [October 1, 2022, 2:47pm UTC](https://forum.xojo.com/t/check-platform-type/72508/5 "2022-10-01T14:47:08Z")

</div>

I solved the issue with checking self.clientHeight and self.clientWidth.  
Thank you, but we can’t rely on the documentation. I just posted another issue with downloading files.

---

<div class="post-metadata">

**Author:** ![AlbertoD](https://forum.xojo.com/letter_avatar_proxy/v4/letter/a/dbc845/32.png) [@AlbertoD](https://forum.xojo.com/u/AlbertoD)\
**Post date:** [October 1, 2022, 2:53pm UTC](https://forum.xojo.com/t/check-platform-type/72508/6 "2022-10-01T14:53:29Z")

</div>

> [@Herman\_Dubach](#):
>
> but we can’t rely on the documentation

> [@Herman\_Dubach](#):
>
> [http://man.hubwiz.com/docset/Xojo.docset/Contents/Resources/Documents/docs.xojo.com/UserGuide\_Web\_Mobile\_Support.html](http://man.hubwiz.com/docset/Xojo.docset/Contents/Resources/Documents/docs.xojo.com/UserGuide_Web_Mobile_Support.html)

That is not the official/current documentation but a snapshot of old docs, you should use [https://documentation.xojo.com](https://documentation.xojo.com)
