I have a javascript code that will run on different SharePoint platforms ( Office365, SharePoint 2013 & SharePoint 2016 )
I would like to detect the environment my code is running on, so I can add some CSS classes to control page behvaior based on the environment that I am running on.
How can I detect all those environment, note that code should still work if page is accessed anonymously ( SP.ClientContext
is not an option here )
something like:
if ( isSharePoint2013() ) {
document.documentElement.className += ' sharepoint-2013';
} else if ( isSharePoint2016() ) {
document.documentElement.className += ' sharepoint-2016';
} else if ( isOffice365() ) {
document.documentElement.className += ' office-365';
}
so what could be the logic behind those detection methods, in order to detect the right platform type ?