4

Is there a way to detect if SharePoint is using the system master page? (just like EditModePanel, or detecting the system master page with javascript..)

Right now I'm using the same master page on both.

What I want is to display the site title in the system masterpage. If you are in _layouts/settings.aspx or Site Contents etc., the users does not know where they are (url is the only way to know where you are, and that is not good enought). I don't want to make 2 master pages (maintenance) just for the "navigation title" in the page.

Publishing features are turned on.

3 Answers 3

2

Aside from any API calls, why not just modify the master pages to include some javascript that sets a variable telling which master it is

Var master="masters?asps"

1
  • I'm not sure how this would work. If I'm using the same master page for publishing and system master page
    – Plexus81
    Jul 15, 2014 at 8:38
0

how you want to detect. there are couple of ways to check which master page is being used.

if you don’t have the Publishing feature activated navigate to

http://your_server.com/sites/examples/_Layouts/ChangeSiteMasterPage.aspx

If you do have the Publishing feature enabled you can go to Master Page on the

Site Settings page, under Look and Feel category

Or you can take the advantage of CustomMasterUrl or MasterUrl properties of a web.

$web = Get-SPWeb http://sharepoint

$web.CustomMasterUrl = "/_catalogs/masterpage/nightandday.master"

$web.MasterUrl = "/_catalogs/masterpage/nightandday.master"

$web.Update()

.

3
  • I don't want to set the masterpage. I just want to detect witch master page the page is currently using.
    – Plexus81
    Jun 25, 2014 at 18:21
  • dont set it, but still you go to that pages you will know which master is being used
    – Waqas Sarwar MVP
    Jun 25, 2014 at 18:22
  • It's possible to make an javascript that detects different "system" pages, but I don't like that approach. Is there a way to detect system pages?
    – Plexus81
    Jun 26, 2014 at 8:08
-1

Maybe some basic JavaScript like

if (window.location.href.indexOf("_layouts") > 0) { console.log("This is a system page"); }

Your Answer

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

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