Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save HoldenCreative/3633299484e8fd86fc69408bf9d91597 to your computer and use it in GitHub Desktop.
Save HoldenCreative/3633299484e8fd86fc69408bf9d91597 to your computer and use it in GitHub Desktop.
Method to detect for Windows OS and Edge Chromium in JS
document.addEventListener("DOMContentLoaded", function() {
// Function to detect if the OS is Windows
const isWindows = () => navigator.platform.indexOf('Win') > -1;
// Function to detect if the browser is Edge
const isEdge = () => navigator.userAgent.indexOf('Edg/') > -1;
// Applying the CSS rules if the OS is Windows and browser is Edge
if (isWindows() && isEdge()) {
const elements = document.querySelectorAll('.userflowjs-resource-center--placement-bottom-left, .userflowjs-resource-center--placement-bottom-right');
elements.forEach(element => {
element.style.setProperty('bottom', '1.5rem', 'important');
element.style.setProperty('left', `var(--userflow-resource-center-padding-x)`, 'important');
element.style.setProperty('right', 'unset', 'important');
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment