There are two options to detect if your site is running in Polypane. You can use this information to display additional debug information, or serve up various instances of your design (for example, dark and light themes) and test those side by side.
Option 1: user agent
The Polypane user agent is derived from the Chrome user agent and looks like this:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Polypane/2.1.0 Chrome/78.0.3904.126 Electron/7.1.3 Safari/537.36
The user agent will tell you which version of Polypane and Chromium is being used.
If you use device emulation then the user agent might be overwritten. For that we have another option:
Option 2: __polypane object
When running in Polypane, the
window object is extended with a
__polypane key. This is an object that gives you information
on the pane your page is running in. It has these properties:
width: The width of the pane in pixels
height: The height of the pane in pixels
index: The (zero-based) index of the panel
title: The title of the pane
hidden: Whether the pane is visible in the UI or not (boolean)
overlay: Which, if any, overlay is currently active on this pane
When running in isolate panes mode, there are additional properties:
emulation: An object with the emulation options as applied to the pane:
extraHeaders: a string with the extra headers being sent to this pane.
Option 3: The
When running on Polypane, the HTML element will have the 'in-polypane' class applied to it, letting you style based on it.
Is your question not answered?
Ask via Twitter, Slack or our contact form
The browser for developers and designers building amazing sites and web apps.Try for free