1 Reply Latest reply on Oct 14, 2014 3:54 PM by Bhess

    Various issues with IE and PI Web API access

    Roger Palmen

      Running PI Web API 2014R2 on a (domain-less) Win2008R2 server, i encounter some  issues with Internet Explorer on a number of sites / customers. My results so far (not my area of expertise, and work in progress)


      Typically, after installing the PI WEB API, you want to test if it works by pointing your browser to https://<<server>>/piwebapi. But it turns out, there are some pitfalls as IE does not support showing JSON responses in the browser...The WEB API's JSON responses are markes as contenttype= application.json, which seems to be the norm, but IE does not support that norm...

      • Google Chrome from external computer: no problems at all...
      • IE11 from external computer: asks to save the piwebapi.json file...
        • Now this is hinted at in the troubleshooting section of the PI WEB API User Manual: After UNchecking "Display Intranet sites in Compatibility view", it works in IE11, without applying the registry hack below... In my case, the auto-detection of intranetsites was turned on, placing this site in the Intranet sites and therby kicking off this issue.
      • IE8 locally on server: as this is a server, IE enhanced security turned on.
      Any ideas on IE8?
      Some recommendation to OSIsoft: as often the first thing after installation is to run a quick test, you might include some HTML & Javascript example that connects to the PI WEB API to show it works correctly? That should bypass a number of these issues...

      Other details:

      • Self-signed certificate on server.
      • Set Anonymous authentication to rule out hop issues. 
      PS: It's only now that i note that most screenshots on vCampus are made using Chrome, not IE...
        • Re: Various issues with IE and PI Web API access

          If you're getting pure JSON in the browser/a prompt to download, I suspect that it's still compatibility view.  Perhaps the compatibility view icon is selected in the toolbar?


          The view that you're used to seeing in the browser, which contains links to documentation, and hyperlinks, is actually HTML.  PI Web API performs content negotiation to determine what kind of response to render: either JSON or HTML.  By default, the browser sends an Accept header with a list of acceptable content types in preferred order.  Normally, 'text/html' or 'application/html' is the first of these, as the browser prefers to get HTML over any other media type.  However, IE compatibility mode sends a very strange list of Accept headers:


          Accept     image/jpeg, image/gif, image/pjpeg, application/x-ms-application, application/xaml+xml, application/x-ms-xbap, */*


          We want to continue to send JSON by default, since we are after all an API.  But the compatibility view issue is so common, I think we might start rendering HTML when the application/x-ms-application header is received.