Detecting Office and then loading office.js and related .css files RRS feed

  • Question

  • Hi, what are some best practices for detecting Office and loading the proper .css files if I would like to share the webpage with regular browser users? I suppose one way is to load office.js always and then check if Office is defined, but it seems there might be better ways.
    • Edited by tofutim Tuesday, November 20, 2012 11:41 PM
    Tuesday, November 20, 2012 11:40 PM

All replies

  • Hi,

    Thanks for posting in the MSDN Forum.

    It's based on my experience that Off app will use JQuery to handle business. And JQuery support define CSS style in the code. You are able to approach your goal via it.

    Have a good day,


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, November 22, 2012 7:44 AM
  • Do you have any code samples available? Specifically, I have an MVC 4 website that uses the default _Layout.cshtml. Ideally I would like the _Layout.cshtml to detect Office and apply the Office.css instead of the regular .css. This way everything can get propagated to all the pages.
    • Edited by tofutim Tuesday, November 27, 2012 12:00 AM
    Monday, November 26, 2012 11:48 PM
  • Ideally I'm looking for something like this

    @if (Request.Browser.IsMobileDevie) {
      <!-- HTML here for mobile device -->
    } else {
      <!-- HTML for desktop application -->

    but Request.Browser.IsOffice2013App

    Tuesday, November 27, 2012 5:21 PM