Search code examples
windowsterminal-services

How to detect, from browser, if user is running in Remote Desktop session?


Is there a ways to check inside a browser (e.g. javascript) if the user is running inside a Remote Desktop session?


If the user is running their browser inside a Remote Desktop (i.e. Terminal Services), i want to disable animations on the web-site.

If this were a native application, as opposed to a web-site, i could perform this checking using:

//Native code
isRemoteSession = GetSystemMetrics( SM_REMOTESESSION );

or

//Managed Code:
isRemoteSession = System.Windows.Forms.SystemInformation.TerminalServerSession;

Is there a similar check that can be done inside the browser?

Note: Assume for the purposes of this discussion that the browser we're talking about is Internet Explorer 8.


Update One: Perhaps something in How can you get the terminal service client machine name from javascript?


Solution

  • You can use the following media query:

    @media screen and (prefers-reduced-motion: reduce) { . . . }

    This condition can also hold for non-RDP sessions, but as your intention is to disable all animations, this type of query is probably exactly what you're looking for.