You're right, the "Open in new window" button that appears in the command bar of Dynamics 365 Unified Interface forms is a standard, client-side browser functionality triggered by the platform. It's not a traditional ribbon button that you can directly manipulate using the Ribbon Workbench.
However, you can hide this button using Client-Side JavaScript that runs when the form loads. Here's how you can achieve this:
Method: Using JavaScript to Hide the "Open in New Window" Button
The strategy involves targeting the specific HTML element that constitutes this button and setting its display
style to none
.
Steps:
HideOpenInNewWindowButton.js
).HideOpenInNewWindowButton.js
).HideOpenInNewWindowScript
).hideOpenInNewWindow
.Explanation of the Code:
function hideOpenInNewWindow() { ... }
: This defines the JavaScript function that will be executed when the form loads.setTimeout(function() { ... }, 100);
: This introduces a small delay (100 milliseconds) before trying to find and hide the button. This is important because the DOM (Document Object Model) of the form and its elements might not be fully loaded and rendered immediately when the OnLoad
event fires. Adjust the timeout value if you find it's not consistently working.document.querySelector("button[aria-label='Open in new window']")
: This line uses a CSS selector to find the HTML button element that has the aria-label
attribute set to "Open in new window". This is a reliable way to target this specific button provided Microsoft doesn't change the aria-label
.if (openInNewWindowButton) { ... }
: This checks if the button element was found.openInNewWindowButton.style.display = 'none';
: If the button is found, this line sets its display
style to none
, effectively hiding it from view.Important Considerations:
aria-label
of the "Open in new window" button in a future update, this script will stop working, and you'll need to update the CSS selector. Keep an eye on release notes and test after major updates.Alternative (Less Recommended for Global Hiding):
While not a direct way to hide the button, you could potentially educate users on alternative ways to open records in new tabs or windows using their browser's right-click context menu or keyboard shortcuts (e.g., Ctrl+Click or Cmd+Click). However, this doesn't fulfill the requirement of hiding the button itself.
By following the JavaScript and web resource approach outlined above, you can effectively hide the "Open in new window" button from all your Dynamics 365 forms. Remember to test thoroughly after implementation.
Daniyal Khaleel
143
DAnny3211
134
Abhilash Warrier
70
Super User 2025 Season 2