Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

How can I check if a page is in ?pagepreview=true mode?

I've branded the sharepoint ribbon and need to check if a page is in pagepreview to get the site branded correct (js / css). Is there a way to do this without checking the url with JS

window.loaction.href.indexOf("?pagepreview=true") > -1

I'm trying to check this in the ex masterpage.

share|improve this question
5  
Are you asking if there is a different way to check it in JavaScript, or if there is a way to check it WITHOUT using JavaScript? Where are you checking for this, within a Content Editor Web Part? Within the master page? Where? –  CigarDoug Jan 21 '13 at 16:34
    
I'm looking for a way to check this with javascript. –  Plexus81 Aug 27 '13 at 10:31

1 Answer 1

On the server side you can check QueryString params

[C#]
bool isPagePreviewMode = Convert.ToBoolean(HttpContext.Current.Request.QueryString["pagepreview"]);

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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