MATLAB Answers

1

Detect the MATLAB Help Browser

Asked by Sam Roberts on 7 May 2013
I'd like to create some HTML documentation for a large MATLAB application, to be viewed mainly within the MATLAB Help Browser, in any version of MATLAB from 11b on. This would have some custom CSS (but nothing very complicated).
However, I'd also like the same documentation to be viewable within other browsers. I care about Chrome and IE9 and 10, although support for other browsers would be welcome. I'd like the documentation to
  1. Look essentially the same across all the browsers including the MATLAB Help Browser, but
  2. In a few ways look different when presented in the MATLAB Help Browser - in particular, I want matlab: links to be displayed and behave differently, as they are not supported outside the MATLAB Help Browser.
Question 1: I'm running into difficulty even with 1, as despite the simplicity of my CSS the MATLAB Help Browser seems unpredictable in what parts of CSS it supports, and it seems to vary a great deal across MATLAB versions. I'm guessing that it's not documented at all. Does anyone have any experience/tips about using CSS in the MATLAB Help Browser?
Question 2: I was hoping to be able to auto-detect somehow whether the matlab: protocol was supported in the viewing browser, but it seems from browsing some StackOverflow questions that this is not possible. Given that I need to support Chrome, it's not even possible to try following a matlab: link and detect if it fails, as apparently Chrome fails silently. Boo. So my next thought is to use JavaScript to detect the UserAgent of the browser.
MATLAB 11b reports itself as Mozilla4.0 with ICEbrowser, whereas 13a gives Mozilla4.0 with Trident6. I'm not entirely sure what these are - I'm guessing they're third-party Java-based browser components that behave like Mozilla, and MathWorks have changed the component between 11b and 13a.
If I detect the UserAgent and assume that anything containing the strings ICEBrowser or Trident is the MATLAB Help browser, is that likely to be sufficient to identify the MATLAB Help Browser for most purposes? Obviously I'll have to keep up to date with UserAgent strings for post-13a releases.
Thanks for your suggestions!

  0 Comments

Sign in to comment.

0 Answers