This is a workaround at best.
This solution feels quite dirty and just wrong, but I am posting it in case it can lead to even more interesting approaches.
When displaying a modern page in an iframe
, the navigation and header is hidden for us.
Create a classic page (you might have to enable the publishing features to do this), and add a script web part with an iframe that points to your application page.
Sprinkle on some jQuery and css (on classic pages, these classes won't change - so it should be safer to play with that), and now you can access this page by adding ?IsDlg=1
in the URL.
Result:
The code I used for the script web part:
<iframe id="embedframe" style="overflow:hidden;height:100%;width:100%" height="100%" width="100%" frameborder="0" src="https://contoso.sharepoint.com/sites/Playground/SitePages/Embed-this.aspx"></iframe>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript">
_spBodyOnLoadFunctionNames.push("reallyhide");
function reallyhide(){
if(window.location.search.toLowerCase().indexOf("isdlg=1") > 0){
$("#s4-ribbonrow").hide();
$("#embedframe").css({"position":"absolute","top":"0","left":"0"});
}
}
</script>
<style>
#s4-bodyContainer {height:2000px;}
</style>