Created
April 18, 2024 18:25
-
-
Save HoldenCreative/3633299484e8fd86fc69408bf9d91597 to your computer and use it in GitHub Desktop.
Method to detect for Windows OS and Edge Chromium in JS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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