Hide the navigation and the header in modern SharePoint pages

Displaying a modern SharePoint page without the navigation and the header have generated all sort of hacks over the years that try to replicate the famous ?isDlg=1 and the focus mode from classic SharePoint by manipulating the DOM and injecting custom css.

I’ve recently discovered the query string that can be used with modern SharePoint site URLs to strip the pages from all its elements living it just with the content.

Focus on SharePoint content

?env=Embedded or ?env=WebView are the new ?isDlg=1

By adding the query string ?env=Embedded or ?env=WebView to any modern SharePoint URL (including lists) you will be automatically removing the navigation, header and footer form the page ending just with the content.

In the following animation you can see the differences between a normal and an embedded page.

Embed a SharePoint page

Note: Despite being included in the Microsoft JS files the query string is not documented which means that it is not officially supported.

If you want to preserve the suite bar in the page you can use the query string used by Microsoft Lists – ?env=WebViewList – this however will just work with pages, when added to a list it redirects the user to the Microsoft Lists application.

Embed a SharePoint page


7 Responses to “Hide the navigation and the header in modern SharePoint pages”

  1. Chris Anderson

    January 25, 2021

    very nice info! thanks

    Reply
  2. Joy Apple

    January 25, 2021

    bomb.com! Thank you!

    Reply
  3. fritz Schick

    January 25, 2021

    This is great to know.
    Thanks!

    Reply
  4. Robert Davis

    January 26, 2021

    Great tip! Thank you!!

    Reply
  5. Somy

    January 28, 2021

    Awesome! Along SPFx solution, this is even cooler!

    Reply
  6. Asad

    April 20, 2022

    Great solution, but how we can make this permanent. because if users delete the URL backwards it will bring back the original page settings back?

    Thanks
    Atif

    Reply
    • João Ferreira

      April 27, 2022

      Hi Atif,

      There is no easy and recommended way of doing this permanently.
      The alternative would be creating a custom SPFx solution to remove all the elements, however this would not be persistent overtime as Microsoft continues to add more and more feature to SharePoint you would need also to update the solution.
      This solution is more for you to integrate modern pages without the SharePoint artefacts in other applications like Microsoft Teams rather than sharing the page with the query string in the URL.
      Hope this helps to clarify.

      Have a nice day 🙂

      Reply

Leave a Reply


I've been working with Microsoft Technologies over the last ten years, mainly focused on creating collaboration and productivity solutions that drive the adoption of Microsoft Modern Workplace.