Is there a way to hide the Share button from all the SharePoint online pages:-

enter image description here


2 Answers 2


For modern UI, anyway you can use a modern script editor to do the same thing. However once you switch to another page, the button still will returns. If you want to restrict users from sharing, it may be better to change the sharing settings to make only owners can share.

enter image description here

Then other members will not have this button on the right top.

enter image description here


You simply need to add a Script Editor or a Content Editor webpart and add the following script (QCB1_Button4 should be the id of the button, but this may change, check with F12 in browser):

<script type="text/javascript">
    function hideEdit() {
        var edit = document.getElementById("QCB1_Button4");
        edit.style.display = "none";

Please mark the answer if it works for you!

  • Script Editor or a Content Editor webpart are not available inside Modern Ui
    – John John
    Nov 27, 2020 at 17:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.